Jump to content


A Wildcard for nothing there at all?

  • Please log in to reply
2 replies to this topic

#1 motorcity

  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 01 February 2013 - 12:25 AM

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?

#2 Jessica

  • Staff Alumni
  • This is not my name.
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 01 February 2013 - 12:27 AM

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!!

#3 motorcity

  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 01 February 2013 - 02:06 AM

No value would be NULL or ''

No value would be NULL or ''

Thanks Jessica, two single quotes works just fine.
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