As a part of my case study, I got a scenario to produce the Employee report for the list of years.
It has following fields named Year, Name, Designation, DOJ, Salary (from table EMPLOYEE) and Total. I write a simple SQL query and produce the values in the report by mapping the corresponding fields.
I have below listed conditions should be satisfied for the aforementioned requirement of report.
YEAR column: Display Value only once for the FIRST ROW for Maximum value of DOJ field value for each set of YEAR. If it has only one record, it display that year.
I will be writing my SQL QUERY ORDERBY DATE_OF_JOINING (DOJ) in DESCENDING sequence. So it will display the records in aforementioned order. But i have no clue how to supress or reset the YEAR value for other records (Other than first row) for each set of year
TOTAL Column: Display Total Value for SALARY field only once for the LAST ROW of each set of year record. I will use SUM function to add those salary fields to get total value. While displaying, how to make it available only for last record alone ?
[imgnothumb]http://bytes.com/attachment.php? attachmentid=83 89[/imgnothumb]
It has following fields named Year, Name, Designation, DOJ, Salary (from table EMPLOYEE) and Total. I write a simple SQL query and produce the values in the report by mapping the corresponding fields.
Code:
--------------------------------------------------------------- ANNUAL FISCALE REPORT - EMPLOYEE HUB --------------------------------------------------------------- Year Name Role DOJ SALARY TOTAL 2015 TEST1 MANAGER 24/05/2015 $12,000.00 TEST2 VP 12/04/2015 $15,000.00 TEST3 VC 01/02/2015 $13,500.00 $40,500.00 2014 TEST4 MANAGER 25/03/2014 $15,000.00 $15,000.00 2013 TEST5 MANAGER 03/12/2013 $12,000.00 TEST6 VP 23/08/2013 $18,000.00 $20,000.00 ---------- $75,500.00
YEAR column: Display Value only once for the FIRST ROW for Maximum value of DOJ field value for each set of YEAR. If it has only one record, it display that year.
I will be writing my SQL QUERY ORDERBY DATE_OF_JOINING (DOJ) in DESCENDING sequence. So it will display the records in aforementioned order. But i have no clue how to supress or reset the YEAR value for other records (Other than first row) for each set of year
TOTAL Column: Display Total Value for SALARY field only once for the LAST ROW of each set of year record. I will use SUM function to add those salary fields to get total value. While displaying, how to make it available only for last record alone ?
[imgnothumb]http://bytes.com/attachment.php? attachmentid=83 89[/imgnothumb]
Comment