SELECT CCY1, CCY2, CER.Exchange_Rate FROM ( SELECT c1.rec_id AS rec_id1, c1.currency AS CCY1, c2.rec_id AS rec_id2, c2.currency AS CCY2 FROM currency c1 CROSS JOIN --all combinations... currency c2 WHERE c1.rec_id <> c2rec_id -- ...removes same pairs ) foo LEFT JOIN -- ...get matching FX pairs CurrencyExchangeRate CER ON foo.rec_id1 = cer.[from] AND foo.rec_id2 = cer.[to]
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter