Jump to content

Condition in Query


abhijitm

Recommended Posts

i have a table wid one column 'B' as primary key and another column 'S' which can hold null values. Now i want to write a query such that[1] i supply a value for 'B' [2] either a value or NULL for 'S'If the field 'S' has some value other than NULL then the rows corresponding to B AND S for the given values are selected and if field 'S' has null then all the rows with value supplied to 'B' are seleceted. Please help me with the query....

Link to comment
Share on other sites

sorry, I don't understand your condition.
In my querry i am using a variable for B and S( they r the columns of a table) In case the value for field S in provided as NULL then i want all the rows with given value of column 'B'and if field 'S' is passed some non-null value then i want the rows having given values for B and SFor example B S1 121 1312 142 now i want to write a querry such that if i pass 1 for B and 12 for S then my querry returns row 1 only and if i pass 1 for B and NULL for S then i get row 1,2 and 3. Hopei make my self clearer now
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...