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

Please Help

Status
Not open for further replies.

theif68

Technical User
Apr 3, 2005
39
US
Ok I have a table that looks like this.

Name Row Section Price
Ryan A 12 $10
Ryan b 12 $10
donna C 5 $20
donna g 6 $40

I need to creat a query that will group by name (keeping only one record) and combine the other fields so I can have all information on one line...

Name Row Section SumPrice
Ryan A,b 12,12 SUM $20 or

Name Row1 Row2 Sec1 Sec2 SumPrice
Ryan A B 12 12 Sum$20

Can this be done???
 
Thanks but how do I use it in a query?
 
Thanks PHV
theif, in case u didnt see, there is an example query in that function

SELECT FamID,
Concatenate("SELECT FirstName FROM tblFamMem
WHERE FamID =" & [FamID]) as FirstNames
FROM tblFamily

If the name of your table is mytbl, this is how your query might be,

SELECT DISTINCT Name,
Concatenate("SELECT Row FROM mytbl WHERE Name = " & Name) As Rows, Concatenate ("SELECT Section FROM mytble WHERE Name = "& Name) As Sections, Sum(Price) As TotalPrice
FROM tblFamily

I havent tested this though
 
Sorry theif..plz note a typo in the query above...
the last word should be mytbl.

Also, let me know if u need help with formatting and using concatenate function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top