Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
These are the dreaded words; I'm a newbie to SQL.
I'm developing a business directory, and I need to import data from my existing database into the new one.
I need to import some data from one table to another in MYSQL before exporting it as CSV, and importing it to the new database.
In one table, the categories table, there are two fields, "ID" and "Category Name".
In the "listings" table, there are all the usual fields (username, password etc) and then "Type", which corresponds to the category ID.
What I would like to be able to do is something like this;
1) Search the field "type" in the listings table
2) Get the number from that field
3) If the number from that field matches the number in "id", in the categories table, Populate the "type" field with the corresponding text from "Category Name"
Is this possible to do in a SQL query, or with PHP? I'd love to find out, I hope someone out there can help me!
0 · ·