| 
					
						 It took me a few minutes to come up with this SQL:
 select cilocs.name, cilocs.region, colocs.station_code, sl.name
 from company_locations colocs 
 inner join companies co on colocs.company_id = co.id 
 inner join city_locales cilocs on colocs.city_id = cilocs.city_id
 inner join locales l on cilocs.locale_id = l.id
 left join station_locales sl on (colocs.station_code = sl.station_code and cilocs.locale_id = sl.locale_id)
 where co.active = true and l.id = 'en_US'
 and upper(cilocs.name) like 'SPA%'
 group by cilocs.name, colocs.station_code, cilocs.region, sl.name;
 
 It's been an hour and half and I still haven't figured out how to write this in HQL.  Any ideas? 
					
  
						
					 |