I have a request, if operator types in nothing ,I will retrive all users. but if operator multiple intput some usernames, I only retirve the users whos’ names are inputed, I am tring to use subquery like below
I am using subquery(table b) as IN condition to get users’ information from table a, and it is working well.
SELECT * FROM a WHERE UserName IN (SELECT UserName FROM b)
But, If table b has nothing, I need to select all Users from a, I don’t know how to do it.
Before I can do this only for one user, if typeInUserName = NULL, WHERE UserName = UserName will retirve all users for me.
SELECT * FROM a WHERE UserName = NVL(typeInUserName,UserName)
case 1 :when there is not records in table B
Case 2 When there are two matching records in table B
Case3 When there are records in table B ,but no matching records.
Cheers GS