MySQL Forums
Forum List  »  Quality Assurance

MySQL Sorting Problem
Posted by: Karthikeyan Balasubramanian
Date: June 13, 2011 11:33PM

I need query for the following scenario

I have the values in category table as follwoing:

Category Names:

1.arul
2.abarul
3.12arul
4.!arul
5.a!


Requirement: when I enter A in a search text box in the form, I expect to see the categories starting with A, sorted by the second letter in alphabetical order.

So I think result will be

abarul
arul
a!
123arul
!arul

I have tried this "SELECT `p1ca_name` FROM tbl_categories WHERE `p1ca_name` like "%a%" order by `p1ca_name` NOT LIKE "a%" ,1+`p1ca_name` ,`p1ca_name` asc"

But it is not working as expected.

Can you please anyone send the query?

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL Sorting Problem
1869
June 13, 2011 11:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.