Database;
MySQL 5.0.96-community-log
This is a pretty basic question.
UPDATE products p
SET p.products_status = 0, p.vendors_prod_comments = "not in warehouse"
WHERE p.shelf_pack = 0
AND p.products_quantity < 1
AND p.inventory < 1
AND p.spec_code = ?
The p.spec_code column is; varchar(1) latin1_swedish_ci NULL=No DEFAULT= None
The query works just fine but I'm adding the last line and the data in that column is a multiple choice of letters, It could be A, B, C, or any of about ten different letters. But for the purpose of the query I'm trying to find where the row entry is simply blank. No value given.
Is there a wildcard I could use here?
Something in the place of my ? mark that would only result if there was no value given.
I'm pretty new at this but any ideas would be greatly appreciated.
As an afterthought, I could probably change that column to default to something, but the question stands. Is there a way?
A Wildcard for nothing there at all?
Started by motorcity, Jan 31 2013 07:25 PM
2 replies to this topic
#1
Posted 31 January 2013 - 07:25 PM
#2
Posted 31 January 2013 - 07:27 PM
No value would be NULL or ''
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
#3
Posted 31 January 2013 - 09:06 PM
No value would be NULL or ''
Thanks Jessica, two single quotes works just fine.No value would be NULL or ''
Helped me weed out another 4500 products we can't actually sell.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












