how to simulate a UNION?

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Oct 17 21:40:16 CDT 2003


on 10/17/03 21:20, Michael Geary at listmail at gearyweb.com wrote:

> Hi Folks,
> 
> I've got 2 tables with similar data. The tables are NOT related, so my
> objectives cannot be achieved with a JOIN. Ideally, I could do a UNION
> like this:
> 
> (
> SELECT
> table1.description,
> table1.id
> 
> WHERE
> table1.description LIKE 'blah'
> )
> UNION ALL
> (
> SELECT
> table2.description,
> table2.id
> 
> WHERE
> table2.description LIKE 'blah'
> )
> 
> order by
> description asc
> ----------------
> 
> But, I can't do this in Valentina. So, I have to find a workaround. One
> problem is that I need to sort the results of both tables together, so
> if I simply do two queries, I have to do a lot of manual work to sort
> the results. I saw a reference in the List Archive at one point to a
> Temporary Table, but I can't find any more info on that. It sounds like
> that would be my best approach, but I can't see anything in the docs.
> 
> I'd appreciate any pointers.

Hi Michael, 

In any UNION will require from DBMS to build TMP table.

So you can do this self.
Make TMP table, then do
    SELECT INSERT INTO
For first table.

Then 
    SELECT INSERT INTO
For second table.

In both cases INSERT into the same TMP Table.
Then you can try sort it...
Not very nice...

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list