Oggy997
ClioSport Club Member
997.1, Caddy, e208
I'm trying to automate a query from our AS400 using ODBC.
I have two select statements that work independently, however I wish to join them - the statements all come from one table and there are no joins, there also some criteria in the where clause present in both. Can someone advise the best way to structure this query? I've highlighted the below which is the only different field in the two queries being returned, if the second one could be aliased as the first, even better?
Can anyone help me out?
Thanks
I have two select statements that work independently, however I wish to join them - the statements all come from one table and there are no joins, there also some criteria in the where clause present in both. Can someone advise the best way to structure this query? I've highlighted the below which is the only different field in the two queries being returned, if the second one could be aliased as the first, even better?
select CLNTTH, PAL#TH, TRDTTH, COMMTH, TRNCTH, TRTMTH, TRNQTH, USERTH, LOCNTH, WSIDTH from warhist
where trdtth between 180104 and 180105 and
clntth not like 'D2' AND
trncth in ('7174', '7163', '71 ', ' 31', '7159', ' 51', '1231', '3171', 'LOAD', ' 60', ' 53', 'SHRK', 'LBEL', 'INVE', 'CSPK')
select CLNTTH, PAL#TH, TRDTTH, COMMTH, PROGTH, TRTMTH, TRNQTH, USERTH, LOCNTH, WSIDTH from warhist
where trdtth between 180104 and 180105 and
clntth not like 'D2' AND
progth in ('RDT181', 'RDT325', 'RDT781', 'RDT310') and
Locnth not like '%%O'
and trnqth = 0
Can anyone help me out?
Thanks