Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Show multiple records in one field using SQL

Posted on 2007-04-03
3
Medium Priority
?
178 Views
Last Modified: 2010-03-19
I'm running an Access front end and a SQL backend.  I have tblDaily and tblRooms.  There is a one to many relationship.  The fields in tblDaily can have multiple rooms.  I want to display 3 fields (Facility, Elevation and Area) from tblDaily but also the multiple rooms from tblRooms all in one field on a report.
Ex: Facility, Elevation, Area, Rm1, Rm2, Rm3

I found Function fncConcat() example code on Expert Exchange but it doesn't work for me because my backend is SQL Server.  Can anyone offer any other suggestions?  Please?
0
Comment
Question by:BobRosas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
dready earned 1500 total points
ID: 18847624
I am not sure wether this will work, but give this a try

select facility, elevation, area, (select concat(rooms) from tblRooms where FID_Daily = tblDaily.id) from tblDaily

(Dont know what your tblRooms looks like, i assumed it has a rooms field and a foreign key called FID_Daily... of course you will have to replace it with real fieldnames)
0
 

Author Comment

by:BobRosas
ID: 18851601
I could really use more help with the SQL statement.  I forgot to include tblTestPerformed which links tblDaily and tblRooms.  Also tblWorkRelease has the field “facility” which I need.  
The following is the SQL code I’m trying but I get the error “Syntax error in query expression ‘(select concat (tblRooms.RoomNo))’.  

SELECT tblWorkRelease.Facility, tblDaily.Elevation, tblDaily.Area, (select concat (tblRooms.RoomNo))
FROM ((tblWorkRelease INNER JOIN tblDaily ON tblWorkRelease.WorkReleaseId = tblDaily.WorkReleaseId) INNER JOIN tblTestsPerformed ON tblDaily.QCReportNo = tblTestsPerformed.QCReportNo) INNER JOIN tblRooms ON tblTestsPerformed.TestDescId = tblRooms.TestDescId
WHERE (((tblDaily.QCReportNo)=2947))
ORDER BY tblRooms.RoomNo;
Thanks!
0
 

Author Comment

by:BobRosas
ID: 18865416
I don't think concat works with SQL but I appreciate that you responded.  I will try reposting my question.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question