Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL question

Status
Not open for further replies.

072463

IS-IT--Management
Jan 10, 2002
6
US
Help!
I have 2 tables, I can manage to use 4 querys to put the data from table1 and caculate the sum of hrs and insert into the second table2(shown as below). Now the question is how I can rewrite the 4 query so it can updated the second table so that all the data is shown in one row that belong to that user instead adding to another row w/ same user again.

User Ttl_Client Ttl_Util Ttl_NonUtil Ttl_NonAsera
Litsinger Jennifer 29
Shubhra Sinha 6
Litsinger Jennifer 4
Shubhra Sinha 12
Shubhra Sinha 18


example of one query of 4:
INSERT INTO total_hrs ( [User], Ttl_Client )
SELECT [UserTime].[User], Sum([UserTime].[Hours]) AS Ttl_Client
FROM UserTime
WHERE ((([UserTime].[Account])="Client"))
GROUP BY [UserTime].[User];

Thanks a million
 
Sorry for the mismatch of the #s in the copy from a .txt format, e.g 4 should be in column Ttl_Util, 12 in Ttl_NonUtil and 18 is in Ttl_Util
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top