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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merging Rows Together 1

Status
Not open for further replies.

safari7391

Programmer
Apr 29, 2003
33
US
MS Access DB 2000

How can I merge 2 rows together from the example below. I would like to merge from the split field. Is it possible to merge split 499 in to split 103 and keep split 103 as an field?

Now
row_date logid split acdcalls acdtime acwtime
6/25/2005 79830 18 3 1059 15
6/25/2005 79830 20 0 0 0
6/25/2005 79830 54 0 0 0
6/25/2005 79830 70 5 2741 1236
6/25/2005 79830 103 8 4762 995
6/25/2005 79830 499 1 331 379

Result
row_date logid split acdcalls acdtime acwtime
6/25/2005 79830 18 3 1059 15
6/25/2005 79830 20 0 0 0
6/25/2005 79830 54 0 0 0
6/25/2005 79830 70 5 2741 1236
6/25/2005 79830 103 9 5093 1374
 
Something like this ?
SELECT row_date, logid, split, acdcalls, acdtime, acwtime
FROM yourTable WHERE split Not In (103,499)
UNION SELECT row_date, logid, 103, Sum(acdcalls), Sum(acdtime), Sum(acwtime)
FROM yourTable WHERE split In (103,499) GROUP BY row_date, logid

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PH, that was the ticket.

Where can I learn more about Union Queries?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top