Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 4th, 2005, 11:13 AM
Registered User
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combining Parameter Queries

Hi all,

I've been struggling with a SQL problem for over a week now. I am using Crystal Reports V8.5. My experience level is 'programmer', and this would be trivial to do in my programming language, but then I don't get the benefits of using reporting tools like Crystal, etc.

I have 3 tables - for simplicity I'll call them Index, Facility, Detail.

Index has 2 fields - {date}, and {pointer to Detail primary key}.
Facility has 2 fields - {Hospital}, and {Clinic}.
Detail has {primary key}, {date}, {clinic}, and {other misc fields}

Selecting by using a date range against the index will yield the least number of detail records.

The end result should be a query that asks the user for a date range, and a multiple selection of hospitals. All clinics associated with the selected hospitals should be included in the output (Each hospital may have several clinics).

Would it be best to join the detail table with the index table first, then use a 'while clinic in (parameter query)' syntax, or try to do the clinic parameter query first, then try to join to the detail and index tables?

I've been successful in doing each part separately, but don't know how to combine them. Any help would be appreciated.

Thank you,
Jere Neal

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with parameter queries ph0neman Classic ASP Basics 2 July 1st, 2008 08:57 PM
Parameter Queries designdawg Access 13 March 5th, 2008 01:39 PM
Combining two Queries arholly Access 1 January 16th, 2007 06:40 PM
Using a parameter with 2 queries archMEL ASP.NET 2.0 Basics 2 September 19th, 2006 07:41 AM
Combining Queries or results from 2 queries Ford SQL Server 2000 24 November 7th, 2005 08:54 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.