MySQL

Moderators: Jonathan
Number of threads: 258
Number of posts: 511

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Find/Replace query Posted by designxen on 20 Feb 2010 at 6:20 AM
Hi,

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"
4) Save.


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!

Thanks,

Xander

Report
Re: Find/Replace query Posted by mike_phd on 24 Feb 2010 at 3:34 AM
It is possible to do in SQL Query
<a href="http://www.essayacademia.com>Essays & Dissertations Qualified</a>
<a href="http://web.usca.edu/">South Carolina University</a>



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.