Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,
I am using Asp.net C# and Postgresql. I need to get record of more than 0.5 of duration.I am using following Query.


SELECT "EmployeeID", "EmployeeName",date("StartTime") ,sum(to_number("Duration",'9999.99')) as "Dur" FROM "Employee_TimeSheet" WHERE date("StartTime") between date('1/1/2016 12:00:00 AM') and date('1/31/2016 12:00:00 AM')
group by "EmployeeID", "EmployeeName",date("StartTime");

Get Following type of Records.

"Name"; "Date" ;"Duration"
"Thirugnana sambantham_V";"2016-01-30";0
"Beeresh_H E";"2016-01-29";0.81
"Prabahar_A";"2016-01-29";0.46
"Ramakrishnan_N";"2016-01-28";0
"Saravanakumar_S";"2016-01-30";1.61
"Madhu_K E";"2016-01-29";2.5
"Marimuthu_V";"2016-01-29";0.99
"Thirugnana sambantham_V";"2016-01-27";0.74



I need only more then 0.5 of duration any one modified my query for that need.

Thanks Advance.
Posted

1 solution

There's two ways I can think of, but Its not clear if you want the total duration to be > 0.5 or select individual records of duration > 0.5 (and sum those looking at your code)

In the first instance, I would look at this PostgreSQL: Documentation: 8.1: Aggregate Functions[^], in the second, well surely you can add the 'and duration ... ' clause to your query
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900