Jump to content

RE-SETTING ID - the correct posting


nazca

Recommended Posts

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....
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.