Click here to Skip to main content
15,890,579 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to insert values in to one table, data from two different tables? Pin
Blue_Boy6-Aug-10 2:32
Blue_Boy6-Aug-10 2:32 
QuestionRe: How to insert values in to one table, data from two different tables? Pin
lovejun7-Aug-10 22:54
lovejun7-Aug-10 22:54 
AnswerRe: How to insert values in to one table, data from two different tables? Pin
Blue_Boy8-Aug-10 6:17
Blue_Boy8-Aug-10 6:17 
Questionsql function Pin
Thanusree Duth5-Aug-10 19:27
Thanusree Duth5-Aug-10 19:27 
AnswerRe: sql function Pin
Blue_Boy6-Aug-10 1:06
Blue_Boy6-Aug-10 1:06 
QuestionCalling Executables from CLR Procedure Pin
Shahzad.Aslam5-Aug-10 6:18
Shahzad.Aslam5-Aug-10 6:18 
QuestionGet Names from Id Pin
SatyaKeerthi155-Aug-10 0:25
SatyaKeerthi155-Aug-10 0:25 
AnswerRe: Get Names from Id PinPopular
Jörgen Andersson5-Aug-10 2:29
professionalJörgen Andersson5-Aug-10 2:29 
Your database model is faulty IMAO.
How about:
Emp
EmpID	Empname
1	xxx
2	yyy
3	ZZZ

Dept
DeptID	Deptname
1	aaaa
2	bbbb
3	cccc

Emp_Dept
EmpID	DeptID
1	1
1	2
2	2
2	3
3	1

then you can use
SELECT  EmpName,DeptName
FROM    Emp e
Join    EmpDept ed
    ON  e.EmpID = ed.EmpID
JOIN    Dept d
    ON  ed.Deptid = d.DeptID

And if you really need to get the deptnames as commaseparated values you can have a look in this thread[^] how to do that.

"When did ignorance become a point of view" - Dilbert

GeneralRe: Get Names from Id [modified] Pin
J4amieC8-Aug-10 23:41
J4amieC8-Aug-10 23:41 
GeneralRe: Get Names from Id Pin
David Skelly9-Aug-10 1:51
David Skelly9-Aug-10 1:51 
GeneralRe: Get Names from Id Pin
J4amieC9-Aug-10 1:53
J4amieC9-Aug-10 1:53 
GeneralRe: Get Names from Id Pin
Jörgen Andersson10-Aug-10 0:27
professionalJörgen Andersson10-Aug-10 0:27 
AnswerRe: Get Names from Id [modified] Pin
J4amieC8-Aug-10 23:43
J4amieC8-Aug-10 23:43 
GeneralRe: Get Names from Id Pin
tarun_j20026-Aug-10 19:05
tarun_j20026-Aug-10 19:05 
Questionabout Oracle & SQLPLUS Pin
alexyxj4-Aug-10 10:51
alexyxj4-Aug-10 10:51 
AnswerRe: about Oracle & SQLPLUS Pin
Yusuf4-Aug-10 13:51
Yusuf4-Aug-10 13:51 
AnswerRe: about Oracle & SQLPLUS Pin
Jörgen Andersson4-Aug-10 20:48
professionalJörgen Andersson4-Aug-10 20:48 
AnswerRe: about Oracle & SQLPLUS Pin
Bernhard Hiller4-Aug-10 21:28
Bernhard Hiller4-Aug-10 21:28 
GeneralRe: about Oracle & SQLPLUS Pin
alexyxj5-Aug-10 11:10
alexyxj5-Aug-10 11:10 
QuestionHow to display data effectively [modified] Pin
Frygreen4-Aug-10 9:02
Frygreen4-Aug-10 9:02 
AnswerVeiws ? Pin
David Mujica4-Aug-10 9:59
David Mujica4-Aug-10 9:59 
GeneralRe: Views ? Pin
Frygreen5-Aug-10 10:27
Frygreen5-Aug-10 10:27 
QuestionHelp with this Stored proc Pin
soorma4-Aug-10 5:20
soorma4-Aug-10 5:20 
QuestionConversion error in ms sql Pin
seeism3-Aug-10 22:43
seeism3-Aug-10 22:43 
AnswerRe: Conversion error in ms sql Pin
seeism3-Aug-10 23:19
seeism3-Aug-10 23:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.