On Wed, Jul 23, 2008 at 7:32 AM, Sytze de Boer <[EMAIL PROTECTED]> wrote:
> Folk, I'm stuck
>
> I'm trying to extract data from 3 seperate tables as follows
> Select date,stockcode,stktype,invnum,SUM(qty) ,sell,desc, "H" as SRCE From
> winhst  Where stktype=333 UNION ;
> Select date,stockcode,stktype,invnum,SUM(qty) ,sell,desc, "J" as SRCE From
> wintime Where stktype=333 UNION ;
> Select date,stockcode,stktype,invnum,SUM(qty) ,sell,desc, "I" as SRCE From
> wininvs  Where stktype=333 GROUP BY stockcode ORDER BY stockcode Into Table
> &myfile
>
> It works fine except I end up with 1 record instead of about 50 (the number
> of stockcode)
> i.e. it does not respect the ORDER by clause
>
> If I do
> Select date,stockcode,stktype,invnum,SUM(qty) ,sell,desc, "I" as SRCE From
> wininvs Where stktype=333 GROUP BY stockcode ORDER BY stockcode Into Table
> &myfile
> it works fine, but (obviously) it excludes the data from the first 2 tables
>
> I must be doing something wrong but I can't figure what it is.
>
> Can someone help ?

Just a thought: try "UNION ALL"

-- 
Paul


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to