# Miscellaneous > SQL Scripts >  emp salary

## sunkara

Hi,Im trying to get Min salary of an emp.. from average income on basis of dates he gets his salary , the below query works can any one help to simplify this query ...

please find query below..!





SELECT MIN(MONTHLY_SAL) AVERAGE_INCOME FROM (SELECT SUM(TXN_AMT) MONTHLY_SAL,A AS DATES FROM (SELECT TXN_AMT,(CAST(MONTH(TXN_DT) AS CHAR(2)) CONCAT'/' CONCAT CAST(YEAR(TXN_DT) AS CHAR(4))) AS A FROM GTDFCIA.CUST_SALARY_TXN WHERE APPLICATION_ID = 'M2007080114384938200' AND CIN='011311415') TEMP GROUP BY A) TEMP1

----------


## rmiao

Do you have table schema? On which rdbms?

----------


## sunkara

Schema name :  GTDFCIA

we are useing DB2 on Mainframes

----------


## rmiao

Table schema is columns and their data type in the table.

----------

