views:

33

answers:

1

I want to let the user select a value from a combo box, and then exclude a row from the result set of a stored procedure based on that selection. Something like this:

Select RegNo from Vehicle Except select  VehicleID from Trip
A: 

I hope this is what you try to achieve:

SELECT RegNo
FROM Vehicle
WHERE _id NOT IN ( 1, 2 )

_id is the primary key of your table Vehicle, put those IDs into the brackets that you want to exclude.

I use the NOT IN to allow excluding more than one row if necessary.

Peter Lang