[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

GoldMine SQL I need a Query

Posted on 2004-08-24
5
Medium Priority
?
254 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 500 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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

649 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