http://www.perlmonks.org?node_id=517954


in reply to Efficient Data Comparison

So you have 5 tables each with 2 columns. First column is date and the second one is a variable. Why can't you just join the tables and get one large table with 5 different variables and one date?.

After you are done with that - you said you want to compare values across these 5 variables. Do you want to compare all rows or do you know how many rows you would want? If you know the dates upfront just pull those dates in a where clause (can be done in the first step also). Once you get the required rows you would retrieve the results row by row and write out your results using the script. (if it is all rows then just do it row by row for the entire table). In all cases there is only one SQL call

I could be missing something important here, hopefully this points you in some good direction!

cheers

SK