March 25, 2014 at 8:24 pm
Hi, I am new in SQL. Now I want to handle the case that if I am selecting for the Name and Unit in table of fruit where Name in ('apple','orange','banana').
However, there are no item call 'banana' in database yet and I want to have a default value for 'banana' like
Name Unit
apple 10
orange 20
banana 0
How can I do this instead of just getting
Name Unit
apple 10
orange 20
Can I do this by using Union??Thanks!
Furthermore information, actually I am doing this with my C# program. Users can search the Unit of the item by using string [] and now I want to have a default value if there is a item can't be search.
March 25, 2014 at 11:12 pm
You can also add clause
"where/and unit <> 0"
OR
"where/and unit > 0"
---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy