Hello.

On Mon 2002-12-09 at 10:56:21 +0530, [EMAIL PROTECTED] wrote:
> MySQL 3.23.53
> 
> I have a table T1 and want to do something like
> 
> SELECT * FROM T1 WHERE A = 1 AND xxx...
> UNION
> SELECT * FROM T1 WHERE A = 2 AND yyy...
> 
> Don't read to much in the WHERE clause, this is just for question
> purpose. Also I know that UNION is available in MySQL 4.x but need to
> have the REPLACEMENT of it in 3.23.x

If your example really reflects what you want, you can use

  SELECT * FROM T1 WHERE (A = 1 AND xxx) OR (A = 2 AND yyy)

but this _may_ be slow, because OR clause is not very optimized
yet. If speed is the reason you ask (I shouldn't have to guess, so
please be more specific next time), you can use a temporary table,
alternatively:

  CREATE TABLE result SELECT * FROM T1 WHERE A = 1 AND xxx...
  INSERT INTO result SELECT * FROM T1 WHERE A = 2 AND yyy...
  SELECT * FROM result

HTH,

        Benjamin.

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to