1

I have a list of categories ordered alphabetically but I want to be able to specify a single category to be included last is it possible to do this with MySQL?

for example

current output:

a
b
c
d
e
f
g
h

desired output:

b
c
d
e
f
g
a

Current MySQL code.

 SELECT * FROM categories ORDER BY parent_id, category ASC

1 Answer 1

2

You can use that 'a' = 'a' returns 1 and 'a' = 'b' returns 0:

SELECT * FROM categories ORDER BY parent_id, category = 'a', category
Sign up to request clarification or add additional context in comments.

1 Comment

is there a way I can select a certain word from a category?

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.