0

I am stuck and getting errors with following string any ideas please im trying to prevent admin (user) being displayed in results.

SELECT * NOT LIKE 'admin' FROM users order by status ASC

I have tryed %admin% as well and i am stuck with errors!

1
  • 1
    You need a WHERE. Commented Jul 26, 2012 at 15:55

3 Answers 3

4

Your syntax is wrong, you want to try something like this:

SELECT * FROM users WHERE username NOT LIKE '%admin%' ORDER BY status ASC
Sign up to request clarification or add additional context in comments.

2 Comments

it dosnt change the results what if it is not like but exact is this same?
It would match the like (since the wildcards can be zero) and wouldn't be included.
4
SELECT *  FROM users WHERE user NOT LIKE 'admin' ORDER BY status ASC;

Put your where clause after the table name

3 Comments

It's WHERE username NOT LIKE 'admin'.
I solved it like this SELECT * FROM users WHERE user_name NOT LIKE '%dmi%' order by status ASC
@MultiMedia Andrew posted his answer first and they were pretty much identical, I recommend you accept his.
1

You don't need NOT LIKE if you're doing a comparison against a simple string. Also, as noted in others' answers your syntax order is mixed up:

SELECT * FROM users WHERE username != 'admin' ORDER BY status ASC

Cheers

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.