Can you please help:
I need a script to use via SSH, that will compare two mySQL databases, then print the result to a file.
I have 2 mysql databases of cars and trucks:
database_old
database_new
Both databases list whether it's a car or a truck, and the year (e.g. 1974 truck)
What I need is a script to check over the new database (database_new), and tell me what TRUCKS are NOT in the old database (database_old).
For example, here is stuff in the old database (database_old):
1988 car
1989 car
1997 truck
1998 truck
here is stuff in the new database (database_new):
1988 car
1990 car
1999 truck
I would want the script to print only the following:
1999 truck
Could someone please help? I am hoping for a script in a format that might, imaginitively, look like this:
mysql -u username -p -e "select truck from database_new where truck !(in database_old)" databasename > new_stuff.txt