Subject | Potential union problem |
---|---|
Author | Robert martin |
Post date | 2005-09-05T05:03:26Z |
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
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