You must Sign In to post a response.
  • Category: SQL Server

    How to check two id's at a time in table

    Example

    select name,id from table
    where (name,id) in (select name,id from table2)

    Error: An expression of non-boolean type specified in a context where a condition is expected, near ','.

    it's thourging error please update the answer.
  • #769956
    Hi

    you can use multiple id here
    select name,id from table where id in (100,121,140)

    this is not suitable for you

    share more info for this?

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #769967
    Hi Sadiq,

    The syntax is wrong:
    select name,id from table
    where (name,id) in (select name,id from table2)

    correct syntax:
    select name,id from table
    where name in (select name from table2) and id in (select id from table2)

    Hope this is what you are looking for.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "If you can dream it, you can do it."


  • Sign In to post your comments