nazca Posted July 15, 2006 Share Posted July 15, 2006 I have over 1000 restaurants with an ID attached to each. The ID is the primary key and not the auto-increment assigned by mysql.I cannot order by restaurant_name, because of how the data is accessed and displayed -- confusing and wish it was that easy.I have to first re-set the restaurant-names in alpha order in the database itself and than re-set the ID's to match so that Pizza Hut does not come before Burger King for example. I have tried to export the data to csv and csv excel, but the error i get everytime is illegal statement terminator or something of that sort.My only option is to re-set this table, but have no idea how. I also tried SQLyog, but guess what... phpmyadmin will not allow it.Hope you can help.... Quote Link to comment Share on other sites More sharing options...
fenway Posted July 15, 2006 Share Posted July 15, 2006 The PK and _not_ auto-increment? Huh? And still, how can you re-set the names if you can't ask the DB to do the same? Quote Link to comment Share on other sites More sharing options...
nazca Posted July 15, 2006 Author Share Posted July 15, 2006 Funny right, but I am using an application that assigns the ID automatically so a restaurant would have this id assigned..Hope that clears it up a little. Quote Link to comment Share on other sites More sharing options...
fenway Posted July 16, 2006 Share Posted July 16, 2006 OK... but I'm still unclear about how you can magically figure out the correct order of the names, but MySQL can't. Quote Link to comment Share on other sites More sharing options...
nazca Posted July 17, 2006 Author Share Posted July 17, 2006 I am not saying Mysql can't, but need to know how mysql can help me to do it. When you input data into mysql it does not automatically alphabetize the restaurants for me. What it does is attached the next ID number to the next restaurant I put in and keeps the ID order correct. Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 17, 2006 Share Posted July 17, 2006 Without an example of your data and its structure, this is very confusing. MySQL doesn't care, and nor you should, about the order (or disorder) in which the data exist in the database. What's important is being able to retrieve the data sorted in whatever particular order you want it processed or displayed. Without knowing any more about the data, data structure, and your query result requirements, it's hard to know what to suggest as a workable solution to your problem. Quote Link to comment Share on other sites More sharing options...
king arthur Posted July 17, 2006 Share Posted July 17, 2006 Are you saying that you cannot sort the restaurant names alphabetically because the names are stored in another table? If so you will probably want to do a join or subquery to get the name from the index and then ORDER BY it. If not I would look at redesigning your database so that they are. Quote Link to comment Share on other sites More sharing options...
fenway Posted July 17, 2006 Share Posted July 17, 2006 Yeah... we'll need to see some sample data, but I find it hard to imagine that some sort of ORDER BY clause won't do the trick. 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.