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
 General SQL Server Forums
 New to SQL Server Programming
 need sql query

Author  Topic 

rameshgoudd
Starting Member

13 Posts

Posted - 2007-12-13 : 06:10:28
hi,

i have a database table,

in that three fields are there..

id, status, rejectionid

1 approved (null)

2 rejected 2 (i have 3reasons(id s are 1 to 3)in othertable)

in the othertable means..rejection table

rejectionid cause

1 bad
2 speeling mistakes
3 other


i need the o/p like this

id status cause
1 accpted (null)
2 rejectd speeling mistakes
the cause is null for the status approved once
and it has the some value for the status rejected

how can i write the query for this

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-12-13 : 06:13:13
[code]Select t1.id, t1.status, t2.cause
from t1 left join t2 on t1.rejectionid = t2.rejectionid[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-13 : 06:13:32
[code]select t1.id, t1.status, t2.cause
from table1 t1 left join table2 t2
on t1.rejectionid = t2.rejectionid[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-13 : 06:13:53
by 9 secs


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-13 : 06:16:53
It shouwed 0 replies in the active topic but when I open, I see three replies.
You are all faster

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-13 : 06:21:40
I set to "reload page every minute"


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -