How can I combine following 2 queries so that I can get two columns PAYMODE and PAYTYPE. Both queries are similar and for same table.Combine two sql queries into one query so that I don't need to execute two separate queries.
SELECT ETBL_DESC_TXT as PAYMODE
FROM tedit
WHERE CO_ID = 'CP'
AND ETBL_TYP_ID = 'PMODE'
AND ETBL_VALU_ID = 'RC'
select ETBL_DESC_TXT as PAYTYPE
FROM tedit
WHERE CO_ID = 'CP'
AND ETBL_TYP_ID = 'PTYPE'
AND ETBL_VALU_ID = 'ER'
you always can do this
In SQL Server you can do this (Can't test it in DB2, sorry)
Since the records appear in different rows of the source data, I will be difficult to retrieve them in a single result row. You can get the results in a single query that gives you two rows. Try this:
The first row will contain the paymode, and the second row will contain the paytype.