Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Is this possible?

Author  Topic 

smadden
Starting Member

2 Posts

Posted - 2007-10-30 : 08:54:14
Relative beginner needing help???

Current query

select st.initials, pub.Publication_description, con.firstname, con.lastname, con.company

from tbl_cts_mailing_ownership mao

inner join tbl_staff st on mao.staff_id = st.id

inner join tbl_cts_mailings mai on mao.mailing_id = mai.mailing_id

inner join tbl_cts_publications pub on mai.publication_id = pub.publication_id

inner join tbl_cts_contacts con on mai.contact_id = con.contact_id

where pub.publication_description like '2006%' and (con.firstname + con.lastname + con.company)!= ''

order by con.company,con.firstname,con.lastname

this returns results

CA Xmas card Steve madden ACME
SS Xmas card Steve madden ACME
SL Xmas card Steve madden ACME
TT Xmas card Larry Long KPOW ltd
LR Xmas card Larry Long KPOW ltd
MW Xmas card Larry Long KPOW ltd


is it possible to represent this as

CA,SS,SL Xmas card Steve madden ACME
TT,LR,MW Xmas card Larry Long KPOW ltd

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-10-30 : 09:28:00
do a search for CROSS TAB reporting

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-30 : 09:28:00
http://www.sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-10-30 : 09:28:31
oooo a tie

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-30 : 09:29:26
quote:
Originally posted by DonAtWork

do a search for CROSS TAB reporting

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Exactly two replies at the same time

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

smadden
Starting Member

2 Posts

Posted - 2007-10-30 : 09:54:31
Thanks very much

Go to Top of Page
   

- Advertisement -