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.
Author |
Topic |
immad
Posting Yak Master
230 Posts |
Posted - 2013-04-22 : 00:55:12
|
my data is like thatCompany ID - Branch ID - Department ID - Employee ID - Employee Name --1 ------------- 1 ------------ 52 --------- 5211 ----------- abc --1 ------------- 2 ------------ 32 --------- 2689 ----------- defi want a query that when i select branch id '1' employeeid its only show that branch employee data and when i select branch id '2' employeeid then it didnt show any data.please help me i am new in sql server 2005.immad uddin ahmed |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-04-22 : 01:01:41
|
Can you explain in detail and also provide expected output...If branchid =1 then output should beCompany ID - Branch ID - Department ID - Employee ID - Employee Name 1 ------------- 1 ------------ 52 --------- 5211 ----------- abcif branchid =2 then output should beEmployee ID 5211Is it your requirement? What should be the output for the case of neither 1 nor 2?--Chandu |
|
|
immad
Posting Yak Master
230 Posts |
Posted - 2013-04-22 : 01:29:00
|
If branchid =1 then output should beCompany ID - Branch ID - Department ID - Employee ID - Employee Name 1 ------------- 1 ------------ 52 --------- 5211 ----------- abcif branchid =2 then output should beCompany ID - Branch ID - Department ID - Employee ID - Employee Name 1 ------------- 2 ------------ 32 --------- 2689----------- defi want two query one for branch id 1 and another for branch id 2immad uddin ahmed |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-22 : 01:37:51
|
[code]DECLARE @branchid intSELECT *FROM TableWHERE branchid = @branchid[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|