PASTE-IT!

Holding 165M in 12425 pastes. Meet us at #paste-it.net, OFTC!
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
select		@start := r_date_from
			,@end := r_date_last
			,SUM(  (TO_DAYS(LEAST(s_date_end, @end)) - TO_DAYS(GREATEST(@start, s_date_start)) ) * sp_price) as total_house_price
from		reservations
inner join	reservation_items
		on	ri_reservationsid = ri_id
inner join	products
		on	ri_productsid = p_id
inner join 	product_groups
on			if (p_type = "house", p_house_public_productgroupsid, p_productgroupsid) = pg_id
inner join 	season_prices
		on 	sp_productgroupsid = pg_id
inner join	seasons
		on	s_id = sp_seasonsid
		and	@start < s_date_end
		and	@end > s_date_start
where		(ri_parentid = 0 or ri_parentid is null)
			and ri_id = 1
group by 	ri_id;
Paste by
nono,
539 day(s) ago
19:43 16-07-2007
in syntax