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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Help

Status
Not open for further replies.

pungigis

Programmer
Dec 5, 2007
71
US
I have a query and I need to be able to prompt for 3 pieces of information, see below.

WHERE
(ccg.Name = 'MCG - Grays Harbor Comm Hosp' or
c.customer = xxxxxxxx)
AND C.COB = '00500 - Early Out Clients'

c.cob is ALWAYS needed, however, if they fill in ccg.name then c.customer can be blank or vice versa, however, there are multiple c.customers for a ccg.name so if they choose ccg.name I need it to grab all the c.customers under it. I really hope this makes sense.
 
The code you posted is not a query, it is a WHERE clause.
Please include all the relevant code, and a better description of what your application is trying to accomplish.

Ni neart go cur le cheile.
 
Code:
WHERE C.COB = @cCOB AND -- If this is mandatory I prefer to put it first ;-)
      (ccg.Name   = ISNULL(@ccgName,ccg.Name) OR
       c.customer = ISNULL(@ccustomer,c.customer))

Pass all as parameters.
If this is not waht you want, lease provide some example dat5a and desired result for all occasions.

Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top