ratzephyr
asked on
GoldMine SQL I need a Query
I need a query that will pull related information from three tables.
The Contsupp, Contact1, Contact2
The query is supposed to get me the fields indicated with those primary contact records with email addresses with hose that have comments indicated.
Here is my query but I do not think I am getting it right as it is pulling too much data, do I need to make a join?
select Contact2.Comments,
Contact1.Company,
Contact1.Contact,
Contact1.Title,
Contact1.Address1,
Contact1.Address2,
Contact1.City,
Contact1.State,
Contact1.Zip,
Contact1.Phone1,
Contact1.Key2 ,
Contact1.Key3,
Contsupp.contsupref,
CS2.Contsupref+CS2.address 1 as email from
Contact2, Contact1, Contsupp, contsupp as CS2 where
( (contact2.accountno = contact1.accountno) and (contact1.accountno = contsupp.accountno) and
Comments = 'mailing listA' and
CONTSUPP.RECTYPE = 'P' AND
CONTSUPP.CONTACT = 'E-mail Address'AND
CONTSUPP.ZIP LIKE '01%')
The Contsupp, Contact1, Contact2
The query is supposed to get me the fields indicated with those primary contact records with email addresses with hose that have comments indicated.
Here is my query but I do not think I am getting it right as it is pulling too much data, do I need to make a join?
select Contact2.Comments,
Contact1.Company,
Contact1.Contact,
Contact1.Title,
Contact1.Address1,
Contact1.Address2,
Contact1.City,
Contact1.State,
Contact1.Zip,
Contact1.Phone1,
Contact1.Key2 ,
Contact1.Key3,
Contsupp.contsupref,
CS2.Contsupref+CS2.address
Contact2, Contact1, Contsupp, contsupp as CS2 where
( (contact2.accountno = contact1.accountno) and (contact1.accountno = contsupp.accountno) and
Comments = 'mailing listA' and
CONTSUPP.RECTYPE = 'P' AND
CONTSUPP.CONTACT = 'E-mail Address'AND
CONTSUPP.ZIP LIKE '01%')
you don't have a join to countsub as CS2 - you will need to specify how you want this second copy linked to the other data
ASKER
Sorry, didn't work, still pulling multiple results. I think I may need a join.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.