You are here:

MySQL/Cross checking Databases in mySQL

Advertisement


Question
Hi,

I'll preface this by saying that I haven't with a command line in any way shape or form in years, so please feel free to spell everything out for me.  Please!  

With that out of the way, I have to cross-check data in mysql tables.  One column is last month's entries, and the second is this month's entries and I'm simply looking for repeat entries to be exported to a new database.

So. . . how do is this done?

Answer
Dear Sir

I'm not fully sure what you mean here but heres what i think you mean, please correct me if i am wrong.

You want a script to check last months entries, agaist this months entries if there is a match move to new database table

or do you mean if there is more than one entry the same in either last month or this month move to new database table so last month and this month only have unique entries in them?

either on of these situations could be written witha simple PHP script, A while loop selects each entry in the table then for each entry find the number of rows that match a key term, then if MySQL number of rows = > 1 you then need a script to move the table contents to another table,

Now continue with the loop for the next entry.

Before writting such a script it is advisable to write a simple structured english statment of what the script should do and they work through it step by step. once each step works continue to the next step rather than trying to write the script all in one go.

Try using http://www.web-application-development.info as a refrence point for scripts plus they have a new forum there dedicated for script help

MySQL

All Answers


Answers by Expert:


Ask Experts

Volunteer


stuart gregory

Expertise

PHP html, xhtml, css coding and MySQL

Experience

My experiance is all first had as I am web developer and I have, and do build many websites all using php and mysql. This ranges from building a simple search engine to secure php login scripts. Some websites like http://www.web-application-development.info are complete database driven websites.

Organizations
I have a large number of websites which I host and maintain, such as. http://www.webreger.com http://www.protorrent.co.uk http://www.web-application-development.info http://www.mythslegendsandfolklore.co.uk

Education/Credentials
Web application development. (Open University) BSC Honers Computing and development (Open University)

©2012 About.com, a part of The New York Times Company. All rights reserved.