SQLTeam.com | Weblogs | Forums

Group By


#1

I am trying very hard to figure out how to write this query and just having a really tough time. I don't think I can put an attachment so let me see if I can paste something.

data have
vendor name function market line contact contactemail address city state zip
Access IPA Alpha MSO CM VA COM Jason Doe jldoe@comcast.net 121 Single Street Lancaster CA 92777
Access IPA Alpha MSO CR DC MCD Sarah Doe sdoe@comcast.net 5732 Jones Street Fremont CA 92898
Access IPA Alpha MSO UM TX MCR Jessica Doe jdoe@comcast.net 181 Pringle Street Hayward CA 93092

data need
vendor name function market line contact contactemail address city state zip
Access IPA Alpha MSO CM, CR, UM VA, DC, TX COM, MCD, MCR Jason doe, Sarah Doe, Jessica Doe jldoe@comcast.net, sdoe@comcast.net, jdoe@comcast.net 121 Single Street, 5732 Jones Street, 181 Pringle Street Lancaster, Fremont, Hayward CA 92777, 92898, 93092

I was trying a group by but that did not work. I wished I could paste so it keeps the formatting. Any one know how to accomplish this. I was thinking a union but that did not work


#2

please provide sample data as follows?

create table #beerfest(vendor varchar(50), name varchar(50), funkccion varchar(50), market varchar(50), line varchar(50), contact varchar(50),
contactemail varchar(50), address varchar(50), city varchar(50), state varchar(50), zip int)

insert into #beerfest
select 'Access IPA', 'Alpha MSO', 'CM', 'VA', 'COM', 'Jason Doe', 'jldoe@comcast.net', '121 Single Street', 'Lancaster', 'CA', 92777 union