JOIN Template -- A simple inner join template
--JOIN TEMPLATE
--**************************
--Common Key between Tables :
--Table 1 :
--Table 1 Alias :
--Table 2 :
--Table 2 Alias :
SELECT <<table1Alias>>.<<commonKey>>,
<<column1>>,<<column2>>,<<column3>>
FROM
<<table2Name>> <<table2Alias>>
JOIN <<table1>> <<table1Alias>>
ON <<table2Alias>>.<<commonKey>> = <<table1Alias>>.<<commonKey>>
WHERE <<column#>> = <<someValue>>
AND <<<column#>> = <<someValue>>
--Example Use *******************************************
--JOIN TEMPLATE
--**************************
--Common Key between Tables : incentive_id
--Table 1 : incentive_terms
--Table 1 Alias : it
--Table 2 : incentives_common
--Table 2 Alias : ic
SELECT it.incentive_id,
rate, description, dealer_legal, consumer_legal, incentive_type_id
FROM
incentives_common ic
JOIN incentive_terms it
on ic.incentive_id =
it.incentive_id
WHERE incentive_type_id = 2
AND active_flag = 1