Subject Re: [ib-support] nested union with group by
Author kishore@jlmatrix.com
shoud be seen under task message tab

>
> hello!
>
> would it be possible for the result set of a nested "union" statement
> be used with "group by" statement?
>
> here's a generalized form of my query:
>
> select field1, field2, SUM(field3), SUM(field4)
> from table1 A, table2 J
> where A.field1 = J.field1
> and A.field2 IN ('a', 'b','c','d', 'e', 'f', 'g')
> AND A.field1 in
> (select field1
> FROM table1 A, table2 J, table3
> WHERE A.field1 = J.field2
> AND table3.field5 = J.field5
> AND J.field6 = 'AP'
> AND APV.field7 >= '<Date>'
> UNION
> select field1
> FROM table1 A, table2 J, table3
> WHERE A.field1 = J.field2
> AND table3.field2 = J.field3
> AND J.field2 = 'AR'
> AND table3.field4 >= '<Date>')
> GROUP BY field2, field3
>
> if not, any idea how would i go about it?
>
> thanks in advance!
>
> Maan 8)
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>



[Non-text portions of this message have been removed]