Query

  • Select empid from tblemp.

    Result set:

    244

    254

    253

    I want to check if each empid is either Accepted 'A'/ Rejected 'R'/Pending 'P' from tblstatus by doing some join like select statusid from tblstatus inner join tblemp on tblemp.empid=tblstatus.empid where empid=@empid.

    I need the result set in a single column the following way

    244-P

    254-A

    253-R

    Pls let me know if this is possible.

     

  • to Concatenate your fields you would use

    select convert(varchar,tblemp.empid) + tblstatus.statusid

     

    although from your description it looks like tblstatus has both the employee id and the status so you could use

    select convert(varchar,empid) + statusid from tblstatus


  • Just curious... why do you need a single column?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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