My Question is I need to get two conditions first one if a user is admin I need to display all transactions but if a users is not admin I need to display his own transaction only. hers is the code that I tried but does not work.
Tables I have
Users(Id, username, password, category ...etc)
Transaction (Id, name, description, username, …etc)
SELECT IF ( (select category from users where username = ‘ali’ )==’A’) THEN
Select * from transaction
ELSE
Select * from transaction where username = ‘ali’
I also tried with this one but still no solution
SELECT IF(
SELECT category FROM users where username= 'ali' AND category ='A',
SELECT * FROM Transaction ,
SELECT * FROM Transaction where username= 'ali'
)
Thanks