Subject RE: [firebird-support] How to use a an integer parameter to fetch parameter = "N" or all rows.
Author Mercea Paul
Suppose u have a dropdowncombobox for selection (All Location is first
value, with -1 value), then u can write sql like this:

Select * from Item

Where ((Project=:ProjectID) and ((-1=:LocationID) OR
(Location=:LocationID)))



If u need for projects to :

Select * from Item

Where (((-1=:ProjectID) OR (Project=:ProjectID)) and ((-1=:LocationID) OR
(Location=:LocationID)))



Regards,

Paul





From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of mlq97
Sent: Wednesday, May 30, 2007 10:32 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] How to use a an integer parameter to fetch
parameter = "N" or all rows.



How can I easily query an integer column to get the rows matching
an integer or also allow all rows to be fetched? EG:

Item.Project (integer)
Item.Location (integer)

(Case 1)
Select * from Item where
Project = :ProjectID and Location = LocationID

(Case 2)
Select * from Item where
Project = :ProjectID and Location = all locations

Thanks
Mitch





[Non-text portions of this message have been removed]