Hi Andy,

First of all you can make a temporary table..

Query 1:
CREATE TABLE t_mytable
SELECT *
FROM myTable
WHERE OnSale = 'Y'
 
Query 2:
INSERT INTO t_mytable
SELECT *
FROM myTable
ORDER BY Category
 
Query 3:
INSERT INTO t_mytable
SELECT *
FROM myTable
WHERE Closeout = 'Y'

Query 4:
SELECT *
FROM t_mytable 

Or ... If it's ok for you to upgrade to newer version
That support the UNION syntax (4.0.x I guess) you can do the following

Query 1:
SELECT *
FROM myTable
WHERE OnSale = 'Y'
UNION
SELECT *
FROM myTable
ORDER BY Category
UNION
SELECT *
FROM myTable
WHERE Closeout = 'Y'

HTH.. :)
Leo

> -----Original Message-----
> From: Andy [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, June 02, 2004 1:34 AM
> To: [EMAIL PROTECTED]
> Subject: Combining multiple selects into 1 select.
> 
> Hello,
> 
> Is is possible to combine the results of multiple selects 
> into one query/result?  And if so, how do you implement it?  
> A simple example follows:
> 
> Query 1:
> SELECT *
> FROM myTable
> WHERE OnSale = 'Y'
> 
> Query 2:
> SELECT *
> FROM myTable
> ORDER BY Category
> 
> Query 3:
> SELECT *
> FROM myTable
> WHERE Closeout = 'Y'
> 
> I would like to combine the 3 queries into 1 result for easy 
> parsing/manipulation in my program.  Also, each of the 
> queries may/will have duplicate IDs/Records....A record that 
> appears in Query 1 will also appear in Query 2.
> 
> We are running version 3.23.54, for sun-solaris2.8 (sparc)
> 
> Thanks for any help!
> 
> -Andy


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

Reply via email to