Solved

GoldMine SQL I need a Query

Posted on 2004-08-24
5
248 Views
Last Modified: 2008-03-06
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.address1 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%')

0
Comment
Question by:ratzephyr
  • 2
5 Comments
 
LVL 17

Expert Comment

by:BillAn1
ID: 11881769
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
0
 

Author Comment

by:ratzephyr
ID: 11881840
Sorry, didn't work, still pulling multiple results.  I think I may need a join.
0
 
LVL 17

Accepted Solution

by:
BillAn1 earned 125 total points
ID: 11882134
That's what I just said - you need a join between countsub as CS2 and the other tables...
Now, you may not be joining the other tables correctly either, I don't know what the Primary Keys / Foreign Keys etc are on your tables.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how the fundamental information of how to create a table.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question