 FROM label_restaurant
 INNER JOIN restaurant ON restaurant_id=restaurant.id
 INNER JOIN label ON label_id=label.id
-WHERE EXISTS (
-	SELECT 1 FROM bi_restaurant
-	WHERE bi_restaurant.id=restaurant_id
-)
+-- WHERE EXISTS (
+-- 	SELECT 1 FROM bi_restaurant
+-- 	WHERE bi_restaurant.id=restaurant_id
+-- )
+INNER JOIN bi_restaurant ON bi_restaurant.id=restaurant.id
 INTO OUTFILE '/tmp/label_restaurant.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\n';
 
 -- USER - RESTAURANT
 SELECT user_id+300000000,restaurant_id+200000000,type FROM rating_implicit
-WHERE EXISTS (
-	SELECT 1 FROM bi_restaurant
-	WHERE bi_restaurant.id=restaurant_id
-)
+-- WHERE EXISTS (
+-- 	SELECT 1 FROM bi_restaurant
+-- 	WHERE bi_restaurant.id=restaurant_id
+-- )
+INNER JOIN bi_restaurant ON bi_restaurant.id=restaurant_id
 INTO OUTFILE '/tmp/rating_bookmark.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\n';
 
 -- USER - USER

-- INSERT require ids
INSERT INTO bi_restaurant(id)
SELECT id FROM restaurant
WHERE lat BETWEEN 22.311962 AND 22.324885 AND lng BETWEEN 114.166200 AND 114.173131;

INSERT INTO bi_user(id)
SELECT DISTINCT user_id FROM (

FROM user_follow
INNER JOIN user AS u1 ON u1.id=followee_id
INNER JOIN user AS u2 ON u2.id=follower_id
-- WHERE EXISTS (
-- 	SELECT 1 FROM bi_user
-- 	WHERE bi_user.id=u1.id
-- )
-- OR EXISTS (
-- 	SELECT 1 FROM bi_user
-- 	WHERE bi_user.id=u2.id
-- )
INNER JOIN bi_user ON bi_user.id=followee_id OR bi_user.id=follower_id
INTO OUTFILE '/tmp/user_follow.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\n';

-- USER - LABEL
