sql - MySQL: SELECT EXISTS() AS field WHERE field = x -


PROBLEM: I have an inventory table, and a table inventory item to be notified to me. Want to be a nickname field ("isAuction") that the item with the stock number of the list exists in the Auction Items table.

I wrote the following question:

  Select from the list as I have found (select one from the auction * where someone is a.stockNo = i.stockNo In the form of "isAuction")   

This populates the "isAuction" field with 1 or 0, as is required.

Now I add a WHERE status:

  Select from the list as I found (choose from auction * where one. A.stockNo = i though, when I If I add a situation like this, I get an error: "# 1054 - The unknown column is' '' 'option' in the 'clause'.  

Two questions: 1) Where did I get it wrong? Found? 2) Is there a better way to solve my problem?

Try HAVING IsAuction = 1 .

I know somewhere Ha that HAVING has been called more columns than WHERE.

Comments