SQL WHERE Greater than 0


I'm trying to create a query for vb.net connection string which will return values that are greater than 0. So far I have come up with this code of what I thought it was but I am stuck and cannot remember.

Select * From Products WHERE Pro_Qty > 0

Open in new window

Who is Participating?

Improve company productivity with a Business Account.Sign Up

lincstechConnect With a Mentor Author Commented:
I figured it in the database I had the field type set to text instead of number. Got it working.
Assuming you have a table 'products' and that has a field 'pro_qty'  you have a valid sql statement - if some of those values than 0  you will get all the fields for that record.

what is your question?
lincstechAuthor Commented:
I get data type mismatch in criteria expression
Fernando SotoRetiredCommented:
Hi lincstech;

The SQL statement you posted in your question will return all rows whose column Pro_Qty contains a value greater then 0. Is that not what it is returning?

Are you getting an exception? If so please post the exception message exactly as it is returned as well an an inner exception message.

Please post the offending code as well.
lincstechAuthor Commented:
I noticed a field in the database which was changed from text to number which resolved the issue
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.