Home > database > Where after the use case when problems
Where after the use case when problems
Time:09-25
Select * from the User where 1=1 And (in the case when the User. The department='sales' then Table. The User ID=' 001 ' The else Table. Users ID<> NULL end);
The SQL requirement is, Sales department only can view their account information, if the department as' sales department, specifies the incoming user ID (such as' 001 '] for conditions; Other departments can view all the user information, the 'sales department is to see all the query results,
If I write directly and Table. The user ID='001' is no problem, but in the case when will prompt '=' near a syntax error, is this why? Is my grammar have what problem?
Because of the new, also just know this website soon, just apply for account, integral is not much, sincerely ask, thanked here!
CodePudding user response:
The building Lord your fields can be in Chinese
CodePudding user response:
Behind the where can use case, but also get A=B is equation
CodePudding user response:
Is not a field is in Chinese, is the original sentence is too long, I wrote a brief, long also use Chinese simplified the field name