Results 1 to 5 of 5

Thread: Need SQL Query Urgent

  1. #1
    Join Date
    Oct 2007
    Posts
    3

    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

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    What's table schema? On what kind of db?

  3. #3
    Join Date
    Oct 2007
    Posts
    3

    Reply query

    Quote 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.....

  4. #4
    Join Date
    Oct 2007
    Posts
    2

    Lightbulb 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'

  5. #5
    Join Date
    Nov 2007
    Posts
    2
    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
  •