sql - Select aggregrate and date range -


I can not understand this question and it should be easy. But I am getting hurt, how can you ask for a time limit to use the amount associated with a capacitance?

Considering this table:

  payment of the id employee payment payment date 1 48 289.0000 2003-12-22 00:00: 00.000 2 251 458.0000 2003-12- 30 00: 00.000 3 48 248.0000 2003-12-30 00: 00,000 4 167 255.5000 2003-12-30 00: 00: 00.000 5 48 100.00 2004-01-31 00: 00: 00.000 6 251 100.00 2004- 01-31 00: 00: 00 7 7 251 300.00 2004-02-14 00: 00: 00: 000   

I will run a query to see if during a given year How much is the earnings of each employee, for 2003, the results will be as follows: employee's total payment 48 537.00 167 255.50 251 458.00

2004 The results for:

  Total payout of the employee 48 100.00 251 400.00    

In Microsoft SQL Server, you can do this by grouping the data for each employee based on the data using the YEAR function with the HAVING section Can be filtered for a particular year. This query returns data for the year 2004. Select

  Employee, SUM (PayAmount) as TotalPaid, DATEADD (year, DATEDIFF (year, 0, payment), 0) years 1 to 1 year from the Table 1 group employee, dateADD (YEAR, DATEDIFF (YEAR, 0, Paydate), 0) year (DATEADD (year, DATEDIFF (year, 0, salaried), 0)) = 2004    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -