MySQL Forums
Forum List  »  Newbie

For Loop
Posted by: Mario di Filippo
Date: June 20, 2014 05:02AM

Hello,

I a beginner to MySQL and I would like some guidance on the following task.
I need to run the command below on different databases for different values:

SELECT * FROM DB1 where FIELD1 ='AA'

For example if the databases are {DB1;DB2} and the values of FIELD1 are {AA; BB}
I need a loop that does:

SELECT * FROM DB1 where FIELD1 ='AA'
SELECT * FROM DB2 where FIELD1 ='AA'
save results in AA.xls

SELECT * FROM DB1 where FIELD1 ='BB'
SELECT * FROM DB2 where FIELD1 ='BB'

save results in BB.xls


Thank you very much for any help,

Mario

Options: ReplyQuote


Subject
Written By
Posted
For Loop
June 20, 2014 05:02AM
June 23, 2014 07:24PM
June 25, 2014 07:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.