Skip to content

Instantly share code, notes, and snippets.

select 'Qualified pipeline worth ' ||
'<span class=''xl green''>' ||
CASE WHEN currency = 'GBP' THEN '&pound;' ELSE '&euro;' END ||
LTRIM(TO_CHAR(CAST(SUM(CASE WHEN OPPORTUNITY_STAGE != 'Identify' THEN VALUE ELSE 0 end) AS INTEGER), '999G999G999G999')) ||
'</span> (' ||
CAST(100*SUM(CASE WHEN OPPORTUNITY_STAGE != 'Identify' THEN VALUE ELSE 0 end)/SUM(VALUE) AS INTEGER) ||
'% of total), made up of ' ||
'<span class=''xl blue''>' ||
LTRIM(TO_CHAR(CAST(SUM(CASE WHEN OPPORTUNITY_STAGE != 'Identify' THEN NUMBER_OF_OPPORTUNITIES end) AS INTEGER), '999G999G999G999')) ||
'</span>' ||
@mrship
mrship / divisor-by-zero.sql
Created December 11, 2017 17:24
divisor-by-zero.sql
SELECT '<span class=''xl green''>' ||
COUNT_SHARE ||
'%' ||
'</span>' ||
' of lost opportunities are of ' ||
'<span class=''xl blue''>' ||
COMPLEXITY ||
'</span>' ||
' complexity, representing ' ||
'<span class=''xl red''>' ||
select airbnb_bookings.id, airbnb_links.airbnb_connection_id from airbnb_bookings join bookings ON bookings.id = airbnb_bookings.booking_
 id join properties ON properties.id = bookings.property_id join airbnb_links ON airbnb_links.property_id = properties.id where bookings.id in (__booking_ids__)
airbnb_booking_id = __airbnb_booking_id__;
airbnb_connection_id = __airbnb_connection_id__;

thread = AirbnbBookingRepository.new.find(airbnb_booking_id).thread;