Subject Re: [firebird-support] SQL UNION ALL
Author Alberto Pesce
This evening I try your's solution, because now I don't remember if I already tryed.

The Query that I find is like, note the constant_1...2

SELECT SUM(X.A)*constant_1, Y.B, Z.C
FROM X, Y, Z
WHERE
set_condition_1
GROUP BY Y.B, Z.C
OREDR BY Y.B

UNION ALL

SELECT SUM(X.A)*constant_2, Y.B, Z.C
FROM X, Y, Z
WHERE
set_condition_2
GROUP BY Y.B, Z.C
OREDR BY Y.B


thanks, bye
Alberto
>
>
> excuse me , don't you have to try with remove "order by" instead of
> "Grou by"
>
> regards
>
> Alberto Pesce wrote:
>
> >I tryed your's solutions but not run because if I remove the statemant Group
> >by and Order from the first select the function SUM in Select statemant
> >don't accepted.
> >
> >At this point
> >the solution suggeted with "....set_condition_1 OR set_condition_2.... " is
> >probably what I search.... but I don't know how to use the statemant IF THEN
> >ELSE in Select statemant.
> >
> >Any suggest?
> >
> >Thanks a lot
> >Bye
> >Alberto Pesce
> >
> >----- Original Message -----
> >From: "Alberto Pesce" <palberto@...>
> >To: "firebird-support" <firebird-support@yahoogroups.com>
> >Sent: Thursday, February 24, 2005 4:15 PM
> >Subject: RE: [firebird-support] SQL UNION ALL
> >
> >
> >
> >
> >>Thanks very much to all collaborators.
> >>
> >>This evening I try all your's solutions, and I reply the best Query.
> >>
> >>Thanks again!
> >>Bey
> >>Alberto Pesce
> >>
> >>
> >>
> >>
> >>>Hi
> >>>
> >>>
> >>>
> >>>>Hi all,
> >>>>
> >>>>why this union don't work:
> >>>>
> >>>>SELECT SUM(A), B, C, D
> >>>>FROM X,T,Z
> >>>>WHERE set_condition_1
> >>>>GROUP BY B, C, D, A
> >>>>ORDER BY B
> >>>>
> >>>>UNION ALL
> >>>>
> >>>>SELECT SUM(A), B, C, D
> >>>>FROM X,T,Z
> >>>>WHERE set_condition_2
> >>>>GROUP BY B, C, D, A
> >>>>ORDER BY B
> >>>>
> >>>>The queries above (separated) work fine but if I use the
> >>>>statemant union I obtain a SQL error.
> >>>>
> >>>>
> >>>What about:
> >>>
> >>>SELECT SUM(A), B, C, D
> >>>FROM X,T,Z
> >>>WHERE set_condition_1 OR set_condition_2
> >>>GROUP BY B, C, D, A
> >>>ORDER BY B
> >>>
> >>>
> >>>
> >>>[Non-text portions of this message have been removed]
> >>>
> >>>
> >>>
> >>>
> >>>Yahoo! Groups Links
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>____________________________________________________________
> >>Navighi a 2 MEGA e i primi 3 mesi sono GRATIS.
> >>Scegli Libero Adsl Flat senza limiti su http://www.libero.it
> >>
> >>
> >>
> >>
> >>
> >>Yahoo! Groups Links
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
>
> Augusto Sosa Escalada
> SIAF - Gerente de TecnologĂ­a
> www.siafonline.com.ar
> Gabriel Ardoino 514
> (B1704EIL)Ramos Mejia
> Buenos Aires - Argentina
> Tel. 4943 9100 int 343
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>



____________________________________________________________
6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!
Scaricalo su INTERNET GRATIS 6X http://www.libero.it