Jay, thx for your speedy reply.
MySQL does indeed know the "WHERE IN" syntax (bad coding on my part).

I have another question.

There are two tables in the db from which I want to gather information.
These tables are identical, except for two fields that have different names, the same types (but other length constraints, although i don't think that is the problem here), and except for 1 field that is only present in the first table.


Here is my solution:
(SELECT ID, referentie, postcode, gemeente, kadastrale_opp,prijs_zichtbaar, verkoopprijs, status, adres, '' AS hoofdtype FROM gronden WHERE status = 'te koop' ) UNION (SELECT ID, referentie, postcode, gemeente, kadastrale_opp, prijs_zichtbaar, verkoopprijs, doel AS status, straat AS adres, hoofdtype FROM panden WHERE doel = 'te koop' ) ORDER BY verkoopprijs ASC


As u can see, I am trying to schmuck up the field that is only present in one table, by selecting nothing and naming it as that field name (hoofdtype).
The query succeeds, but the row contains no data for hoofdtype.


Can somebody please enlighten me as to the correct answer.

TIA,

Stijn

Jay Blanchard wrote:
[snip]
ANSI SQL has the WHERE key IN (value1, value2, ...)

MySQL doesn't seem to support this.
Is this a faulty assumption, or am i stuck with WHERE key = value1 OR key = value2 ...
[/snip]


It is a faulty assumption, see
http://dev.mysql.com/doc/mysql/en/comparison-operators.html

SELECT stuff FROM table
WHERE this IN (value1, value2, ...)

works just fine



-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to