FROM shops s, shops_location_geometry slg, area_geometry ag WHERE s.sid = slg.sid AND ST_Contains(ag.geo, slg.geo) AND ag.id = 1 ORDER BY s.reg_date LIMIT 5; name | branch | status | reg_date -----------------------+--------------------+--------+------------ 東光飯店 | | open | 2005-12-03 四川料理 京華樓 | | open | 2006-09-16 徳記 | | open | 2006-10-24 東光飯店 | 別館 | open | 2006-10-30 中国ラーメン 揚州商人 | 横浜スタジアム前店 | open | 2007-01-21 (5 rows) 今度はあってそう
slg, area_geometry ag WHERE s.sid = slg.sid AND ST_Contains(ag.geo, slg.geo) AND ag.id = 1 AND s.category @> '{"ramendb":true}' AND s.status = 'open' ; count ------- 194 (1 row) ramendb=# SELECT COUNT(*) FROM shops s, shops_location_geometry slg, area_geometry ag WHERE s.sid = slg.sid AND ST_Contains(ag.geo, slg.geo) AND ag.id = 1 AND s.category @> '{"ramendb":true}' AND s.status = 'open' AND s.sid IN ( SELECT DISTINCT sid FROM reviews WHERE uid = 8999 ) ; count ------- 167 (1 row) 86% の店舗で 食べたことが あるようだ。