Saturday, 15 June 2013

How to order 1,2,3 not 1, 10, 11, 12 in mySQL -


The following code output in the order of 1, 10, 11, 12 of the ID.

I want to make it 1,2,3,4 ...

Can someone tell me what I should do.

  $ Q = $ this-> Db- & gt; Queries ('SELECT P. *; C; N' AS CATName products, leave as P; CID = PC category_ID 'on categories C;);  

Thanks in advance.

First, add a command to the end section:

  category_ id By order  

If category_id is a string, then you should treat it as an integer. There are some ways to do this. I usually add zero, you can put it too.

  Order by category_ id + 0  

No comments:

Post a Comment