MySQL - IF statement -


my code :

select * `invoices` (     user_id = 3 , status="online" ) 

but admin id = 1 (user_id=1)

how can allow admin see data?

in such case need 2 sql queries - 1 regular users, 1 admins. in query admins remove where clause.
application logic (the 1 controls sql queries) should determine user role , based on role should use relevant sql query.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -