Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT ask_name as 'Âàëþòà', ISNULL([AUD], 1) as 'AUD',
- ISNULL([CAD], 1) as 'CAD', ISNULL([CHF], 1) as 'CHF', ISNULL([DKK], 1) as 'DKK',
- ISNULL([EUR], 1) as 'EUR', ISNULL([GBP], 1) as 'GBP', ISNULL([JPY], 1) as 'JPY',
- ISNULL([NZD], 1) as 'NZD', ISNULL([SEK], 1) as 'SEK', ISNULL([USD], 1) as 'USD'
- FROM
- (SELECT DISTINCT cn_ask.name as [ask_name], cn_bid.name as [bid_name], exchange_rate FROM
- (SELECT ask_currency_id, bid_currency_id, exchange_rate FROM dbo.ExchangeRates) as er
- JOIN CurrencyNames as cn_ask
- ON cn_ask.id = er.ask_currency_id
- JOIN CurrencyNames as cn_bid
- ON cn_bid.id = er.bid_currency_id) as cross_rates
- PIVOT (
- SUM(exchange_rate)
- FOR bid_name IN ([AUD], [CAD], [CHF], [DKK], [EUR], [GBP], [JPY], [NZD], [SEK], [USD])
- ) as pvt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement