krisdmd Posted May 28, 2013 Share Posted May 28, 2013 Hello,I have a table called profiles.I have 3 colums, id,property,valueThe property has the items name,rating,birthday and the column value holds the value of each property.Now i want to order my results by the property rating and value Desc.I'm stuck here how i can do this ? Can anyone helps me with that ? Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 28, 2013 Share Posted May 28, 2013 (edited) ORDER BY property DESC, value DESC Edit: If you're saying that you're storing 3 pieces of information in one column, stop it. Fix your structure. Edited May 28, 2013 by Jessica Quote Link to comment Share on other sites More sharing options...
krisdmd Posted May 28, 2013 Author Share Posted May 28, 2013 well i need some kind of sort by property='rating' and the value of this rating DESC I cannot change the structure of the table because it's from a partner site Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 28, 2013 Share Posted May 28, 2013 (edited) Sure you can. How do you expect to use a table that has data just smushed together? As you are discovering, it sort of eliminates all the benefits of a relational database Edited May 28, 2013 by Jessica Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted May 31, 2013 Share Posted May 31, 2013 The property has the items name,rating,birthday and the column value holds the value of each property. What do the values in the property column look like? Is there a separator between each component? Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted May 31, 2013 Share Posted May 31, 2013 you can store your data on your server any way you want. it does not matter what format it is received/retrieved as. you store it so that it makes sense for how you are going to use it and trying to efficiently search for properties by it's name, rating, birthday, or value requires that each of those values be stored in separate columns (unless of course your assignment is to show that you can come up with the query necessary to solve this, in which case you should be attempting to do this yourself rather than asking on a help forum.) Quote Link to comment 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.