Subject Re: Potential union problem
Author Svein Erling Tysvær
Could this be due to certain users not being granted SELECT to one of
the tables? Just guessing...

It is always a good idea to alias table and field names (even though I
don't think it should be necessary in your case). And why 'as
TableSrce' for the second part of the union (though it ought not to
matter)?

Set

--- In firebird-support@yahoogroups.com, Robert martin wrote:
> Hi
>
> We have a screen the display current and historic values that are
> split between two tables. One client claims that not all results
> are showing. Here description indicates all the results from one
> table are missing. She reports this happens to certain clients in
> the system. The display is created using the following sql
>
> SELECT DRTRANSREF, ENTITYREF, 'D' as TableSrce
> FROM DebtorTrans
> WHERE EntityRef = 436
> UNION
> SELECT DRTRANSREF, ENTITYREF, 'C' as TableSrce
> FROM CompletedDebtorTrans
> WHERE EntityRef = 436
> ORDER BY 14 DESC, 5 DESC;
>
> Please note I have not displayed all the field names in the select
> (thus why the order by has larger field numbers). Is this possible?
> Her data has been backed up and restored very recently and our copy
> of here data does not have this problem?
>
> Revisiting this code, should I be aliasing the table / field names?
>
> TIA
>
> --
> Rob Martin
> Software Engineer
>
> phone +64 03 377 0495
> fax +64 03 377 0496
> web www.chreos.com
>
> Wild Software Ltd