I ask myself what is the more performance method when you join table and use JOIN in clause FROM and when you need to use BETWEEN :
SELECT * FROM Tab1 a inner join Tab2 b on (a.pk=b.fk_1 AND a.date between b.date1 and b.date2)
SELECT * FROM Tab1 a inner join Tab2 b on a.pk=b.fk_1 WHERE a.date between b.date1 and b.date2
Which one is the best?
P.S : sorry for my bad english
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `Tab1` ADD INDEX `tab1_idx_date` (`date`); ALTER TABLE `Tab2` ADD INDEX `tab2_idx_fk_1` (`fk_1`);
SELECT * FROM Tab1 a INNER JOIN Tab2 b ON ( a.pk = b.fk_1 AND a.date BETWEEN b.date1 AND b.date2 )