-
Need SQL Query Urgent
Hai Every one
I need one SQL Query
Consider 2 tables A,B.
They have one column called status
User Enters one GroupId in From and click on search button
Tht group id must be there in any one of the table.
If groupID in Table A then it has to retrive the status from Table A.If the GroupID in Table B then it has to retrive status from Table B.
This is my requirement.
Can any one help me to find the query
-
What's table schema? On what kind of db?
-
Reply query
Originally Posted by vraj_chowdary
Hai Every one
I need one SQL Query
Consider 2 tables A,B.
They have one column called status
User Enters one GroupId in From and click on search button
Tht group id must be there in any one of the table.
If groupID in Table A then it has to retrive the status from Table A.If the GroupID in Table B then it has to retrive status from Table B.
This is my requirement.
Can any one help me to find the query
hai chowdry
According to my knowledge u can use the view for this
problem. u can union the two table and use that view.
If it is not suitable for ur ? sorry.....
-
Try this
select coalesce(a.status,b.status,'X') from a full outer join b on
a.GroupId = b.GroupId
where a.GroupId = 'I' or b.GroupId = 'I'
-
hi chowdary
According to my knowledge u can use this query for this
problem. u can union the two tables
select status from(select status,groupid from tb
union
select status,groupid from tc
where groupid=&groupid) where groupid=&groupid
If it is not suitable for ur requiremnet? sorry.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|