Re: Union query
Posted in 1998
Hi all,
myself I got ans., the ans. is as follows
for query-2 if u give 'UNION' only it will remove duplicate rows
that is why 2 rows are retrived, if u say UNION ALL it will retrived
6 rows (i.e. all rows)
if other than this expl. then let me know.
Girish
On Wed, 22 Jul 1998, Girish Kagrana wrote:
> I have two queries as follows
>
> query-1
> -------
>
> select tabid,"from_1st_select" from systables where tabid < 4
> union
> select tabid,"from_2nd_select" from systables where tabid < 4>
> query-1-output
> --------------
> tabid (constant)
>
> 1 from_1st_select
> 1 from_2nd_select
> 2 from_1st_select
> 2 from_2nd_select
> 3 from_1st_select
> 3 from_2nd_select
>
> query-2
> -------
>
> select "from_1st_select" from systables where tabid < 4
> union
> select "from_2nd_select" from systables where tabid < 4
>
> query-2-output
> --------------
>
> (constant)
>
> from_1st_select
> from_2nd_select
>
>
> Question : the 1st query returns 6 rows, that is ok,
> why 2nd query is returning 2 rows, why not 6 rows
>
>
>
>