is this possible to do using join?

  • hi,

    i have query like this:

    select userid, convert(varchar(20),user_date) as userdate,table_name,operation from HRUser_developerlog where operation='insert'

    result:

    userid userdate table operation

    1 Jan 24 2007 11:47AM usermaster insert

    and i want to uses queries :

    if exists(select null from usermaster where userid = 1)

    select 'found'as result

    else

    select 'not found'

    if exists(select null from menumaster where userid = 1)

    select 'found'as result1

    else

    select 'not found'

    if exists(select null from rolemaster where userid = 1)

    select 'found'as result2

    else

    select 'not found'

    then i need a result like this:

    userid userdate table operation

    1 Jan 24 2007 11:47AM usermaster insert

    result result1 result2

    found not found found

    likee this, how to join the firstquery result with other query results.please any one help me to do.

  • I can see what you are trying to do, but I can't understand why? Have a look in SQL Books Online at CASE statements, this will help get rid of the IF EXISTS so that you can have those in one query. 

    If you can explain what your final goal is maybe we could help you further...

     



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply