Click here to Skip to main content
15,898,010 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have a table structure like below

Date	      PID	Time	Bid	Task	Uid	Cflag	Hflag
10/10/2012	12	10	7	Break	10	1	0
10/10/2012	NULL	10	7	Meeting	10	2	1
10/10/2012	NULL	10	7	Break	10	2	1


i need the sum of time for each Bid

Result :

BID    Time

7       30 


please help me to write sql query

Thanks in advance
Mohan

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 16-Oct-12 3:28am
v2
Comments
[no name] 16-Oct-12 9:29am    
You mean something like SELECT SUM(Time) FROM yourTable WHERE Bid=7?

Try:
SQL
SELECT Bid as BID, sum(Time) FROM myTable GROUP BY Bid
 
Share this answer
 
Comments
ridoy 16-Oct-12 13:04pm    
+5
Hi,

SQL
Select Bid,sum(Time) from table group by Bid
 
Share this answer
 
Hi,
Try this query
SQL
SELECT Bid, sum(Time) Time FROM YourTable GROUP BY Bid


Thank you
 
Share this answer
 
Hi following query with group by will help

SQL
select bid,sum(time)
from table
group by bid


Hope that helps, If it does, mark answer as solution and/or upvote

Thanks,
Milind
 
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