Solved

GoldMine SQL I need a Query

Posted on 2004-08-24
5
251 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

705 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