Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 query records

Author  Topic 

froggy
Starting Member

14 Posts

Posted - 2006-11-21 : 03:07:08
Hi,
i have a database containing employees' information. Each employee will belong to one division, one department and up to 3 sections.
My tables are named div, dept, sect, sectII, sectIII.
In my report, i would like to see the employee contact numbers group according to the sections. As such, should one employee belong to 3 sections, his information will appear thrice in the different sections.
Eg.
Section/Role | Name | Mobile No
--------------------------
Sports
Player1 | Michael | 1234567
Player2 | Tammy | 2345678
--------------------------
Arts
Player1 | Michael | 1234567
Player3 | Nicholas | 3456789
---------------------------
Language
Player1 | Michael | 1234567
Player4 | Evelyn | 7654321

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-21 : 03:11:48
How a bout posting some DDL for the tables? And the sample data you used to produce the expected output above?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-21 : 03:20:27
I think what you want is UNION ALL operator.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -