Home > Net >  how to check values between two columns?
how to check values between two columns?

Time:10-14

I have two columns in a table where I need to check if any value is present between them. If yes I need to return that value.

For example

user_id | role_id
 1        2
 3        4
 5        nil
 nil      6

If there are values in both columns then I should return any of them. Is this possible?

CodePudding user response:

Here you can return both if both have values and not null

select * from Table where user_id NOT NULL AND role_id NOT NULL

  • Related