[SQL] 카티션곱, 조인, 조건절
FROM used_goods_board b, used_goods_reply r -> 두 테이블 카티션 곱 한 것, join 한 거랑은 다름 SELECT food_type, rest_id, rest_name, MAX(favorites) AS favorites FROM rest_info GROUP BY food_type ORDER BY food_type DESC; 이렇게 하면 food_type, rest_id, rest_name은 제일 위의 값을 뽑고 favorites는 max 값을 뽑는다. SELECT food_type, rest_id, rest_name, favorites from rest_info where (food_type, favorites) in ( select food_type, max(fav..
2024. 3. 4.