Solved

GoldMine SQL I need a Query

Posted on 2004-08-24
5
247 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Parse field in SQL View 15 98
MSSQL: Replace text (typo) 7 33
What logic to build in order to get a weekly reminder 9 43
MSDN Licensing query 5 55
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now