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

passing variables to "list all" in a querie.

Status
Not open for further replies.

caspar

Programmer
Sep 9, 2000
1
AU
SELECT DISTINCT Operators.SupplierName
FROM Operators INNER JOIN Boats ON Operators.SupplierID = Boats.Operator
WHERE (((Operators.City)='MMColParam') AND ((Boats.Type)='MMColParam1'))


This query works fine when a city and a boat type are selected. However i
wish to have a "view all" cities and "all boats" option... What do i pass to
these variables to "list all" ???

Please help!!!

Cassandra McInnes

[sig][/sig]
 
If you don't want to write 3 separate queries, you can use a
dummy variable, such as -1, to indicate that you want results
that otherwise would be missing.

For the latter, your where clause would become:

WHERE (Operators.City='MMColParam' OR 'MMColParam' = -1)
AND (Boats.Type='MMColParam1' OR 'MMColParam1' = -1). [sig]<p>Jim<br><a href= > </a><br>oracle, vb, some javascript[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top