Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Query Help

Status
Not open for further replies.

gbrian

IS-IT--Management
Sep 22, 2004
96
US
I am trying to do the following:

ALGORITHM:

SELECT [report fields]
FROM [db1]
WHERE [SURVEY ID] = (

SELECT [SURVEY ID]
FROM [db1]
WHERE CAMPAIGN = 'GP00166'
)


How can I do this? I know you can't use WHERE = [list of items]

Thanks in advance!
 
Please post technical information:

Crystal version
Database/connectivity used
Example data
Expected output

I don't understand why you'd want a subquery for this example, it would return the same as:

SELECT [report fields]
FROM [db1]
WHERE CAMPAIGN = 'GP00166'

since they're both pulling from the same table.

Depending upon your version of Crystal, and the database, there are different solutions to subqueries, but your post lacks basic required info.

-k
 
Crystal 10, ODBC >>ORACLE

The problem is that there is more than one record for each survey ID, and those records may be CAMPAIGN, PROMOTION, DATE, etc etc ...so I can pull by campaign but then I will lose all knowledge of promotion. So what I am trying to do is find the list of survey id's related to this campaign, and pull the records from those


 
OK, I see.

In the Create New Connection select Oracle Server and log in (faster than ODBC).

Now click the Add Command and you can paste in whatever SQL you want and add in a parameter if need be at that time as well.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top