To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Database Development

Reply Post New Thread
 
Thread Tools Display Modes
Old Nov 26th, 2006, 03:03 AM   #1
ghall426
Member
 
Join Date: Sep 06
Posts: 63
ghall426 is on a distinguished road (10+)
Database for Fire Department query help

I'm building a database with SQL Express 2005 for the call log for our fire department. I've simplified my database here to show the problem I'm having.

I have a table "CallLog" with info such as call number, address, date, time of call, etc. I also need to keep track of the names of the people who went on the call which could be anywhere from 1 to 80 people, but normally 3 to 5. So I have a second table "Personnel" which has just two fields: the primary key associated with the call (from the CallLog table) and the name of the person.

My problem is when I display all of the data in a grid, how should I display the names of the people? I was first going to create a column and do a subquery to list the names separated by commas:

342 12:45 123 Main Street John Doe Bill, Mike, Fred
343 9:32 567 Oak Street Jane Smith Mike, Dan, Bob, Gary

1. If I choose to do this, will I need to loop through every record in the CallLog table and query the Personnel table to build a string for this last column or is there an SQL statement that can accomplish this?

2. Is there a better solution to what I'm trying to accomplish?

Greg
ghall426 is offline   Reply With Quote
Old Nov 26th, 2006, 12:03 PM   #2
si_the_geek
Super Moderator
 
si_the_geek's Avatar
 
Join Date: Jul 02
Location: Bristol, UK
Posts: 30,093
si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)si_the_geek has a brilliant future (2000+)
Re: Database for Fire Department query help

As far as I know, there is no built-in method for doing what you want.

Depending on your experience and requirements, a Stored Procedure may be the best option, or it may be better in code. To help us determine, we need more details:

Will this style of display only be in the one program?

Will it only be for this one set of data? (Personnel & CallLog)

What language/connection method/etc are you using for this? (eg: VB6 with ADO, VB.Net 2003, ...)
si_the_geek is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Database Development


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:40 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.