simun Posted July 16, 2009 Share Posted July 16, 2009 i have in my query ORDER BY number DESC, and my number is 12/2212/0098 and it work fine, but i need to read that nuber reverse. not 12/2212/0098 but 89000/2122/21, it is posible to do that? Quote Link to comment https://forums.phpfreaks.com/topic/166209-help-with-sql-query/ Share on other sites More sharing options...
trq Posted July 16, 2009 Share Posted July 16, 2009 Numbers don't have / in them. What field type are you using? Quote Link to comment https://forums.phpfreaks.com/topic/166209-help-with-sql-query/#findComment-876439 Share on other sites More sharing options...
simun Posted July 16, 2009 Author Share Posted July 16, 2009 im using varchar Quote Link to comment https://forums.phpfreaks.com/topic/166209-help-with-sql-query/#findComment-876442 Share on other sites More sharing options...
Maq Posted July 16, 2009 Share Posted July 16, 2009 REVERSE(). Quote Link to comment https://forums.phpfreaks.com/topic/166209-help-with-sql-query/#findComment-876444 Share on other sites More sharing options...
simun Posted July 16, 2009 Author Share Posted July 16, 2009 you mean like this  SELECT * FROM objects WHERE zupanija = 1 ORDER BY REVERSE (kategorizacija) DESC  i have try it but dont show nothing Quote Link to comment https://forums.phpfreaks.com/topic/166209-help-with-sql-query/#findComment-876452 Share on other sites More sharing options...
Maq Posted July 16, 2009 Share Posted July 16, 2009 First of all, do you really need every single field from that table? You should only be selecting the fields that you are going to be using. Second, I meant like this:  SELECT REVERSE(kategorizacija) FROM objects WHERE zupanija = 1 ORDER BY kategorizacija DESC  Did you want to order from the reversed order? In that case, you would have to modify the query a bit and include the desired fields you're going to be using. Since you're ordering on a VARCHAR the order will be alphabetical. There may be a technique to order numerically, but not that I'm aware of. Quote Link to comment https://forums.phpfreaks.com/topic/166209-help-with-sql-query/#findComment-876461 Share on other sites More sharing options...
simun Posted July 16, 2009 Author Share Posted July 16, 2009 can i change varchar to something else to order it numerically Quote Link to comment https://forums.phpfreaks.com/topic/166209-help-with-sql-query/#findComment-876470 Share on other sites More sharing options...
simun Posted July 16, 2009 Author Share Posted July 16, 2009 i have a date and there for exsample, 2007-06-12, how i can dispay this in php like 12.06.2007 ??? Quote Link to comment https://forums.phpfreaks.com/topic/166209-help-with-sql-query/#findComment-876483 Share on other sites More sharing options...
fenway Posted July 19, 2009 Share Posted July 19, 2009 i have a date and there for exsample, 2007-06-12, how i can dispay this in php like 12.06.2007 ??? With DATE_FORMAT(). Quote Link to comment https://forums.phpfreaks.com/topic/166209-help-with-sql-query/#findComment-878114 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.