Home Forums SQL Server 2012 SQL 2012 - General make over columns using comma seperated and select in query RE: make over columns using comma seperated and select in query

  • mcfarlandparkway (9/28/2016)


    TY for the response, In the recent code we are selecting data form temp table where DOC NOT IN (select DOC from table where code<> -1)

    This is what the same we are trying to implement here. DOC will replace with all these 3 columns(emp1,emp2 and emp3)

    That's why I tried to separate with comma and again select those columns in the query.

    Structure should be same..

    that's why I tried select * from Employee where (emp1,emp2,emp3) IN (select emp1,emp2,emp3 from employee)

    In the where clause I can use the code which you provided to CAST in the select statement looks good to me.

    No, they should not be the same. One is a single column, the other is a list of columns. Those are not the same structures any more than an integer is the same structure as an array of integers.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA