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.
| Author |
Topic |
|
wiredcontact
Starting Member
1 Post |
Posted - 2008-04-18 : 07:16:22
|
Hi,i have some sql experience and can link tables but the link i am trying to get is not displaying how i need it tohere is the code i am using, which display logical results, but not the ones i need :Pqry = "SELECT * FROM wce_contact INNER JOIN wce_mailer_link ON wce_contact.UNIQUEID = wce_mailer_link.Contactid LEFT JOIN wce_mailer ON wce_mailer.uniqueid = wce_mailer_link.mailerid RIGHT JOIN wce_mailer_attachments ON wce_mailer_attachments.uniqueid = wce_mailer.fileid WHERE wce_contact.uniqueid = '"& Request.QueryString("id") &"'"Ok i have these tableswce_contactThis has the contacts name and addresswce_mailerThis holds the details of the mailer and a link to the wce_mailer_attachments, there would be multiple rows in wce_mailer_attachments table which link to 1 row in wce_mailer.wce_mailer_linkThis holds the wce_contact uniqueid, and the wce_mailer uniqueid. there will be many contacts to many mailerswce_mailer_attachmentsThis holds an individual row for one attachment, but the uniqueid would be the same for multiple rows, Dependant on how many attachments the users adds. i.e. one mailer could have several attachments, they would all have the same uniqueid.Basically the results i am getting using the join i built are displaying each attachment as a separate row when i display the mailers assigned to a contacts record. i need them to display in one single row where the uniqueids are the same in the wce_mailer_attachments and they match the only fileid in wce_mailer.Hope that makes sense.Thanks for any help |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-18 : 07:33:44
|
| http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=53293 |
 |
|
|
|
|
|