updated_at: 2024-12-16 03:49

다양한 실전 Query

예제 1

주식에서 오늘의 최고가가 어떤 특정 기간동안 최고가를 경신한 항목 가져오기

SELECT 
	market_prices.ymd, market_prices.code, market_prices.close, mt.close AS mtclose
FROM 
	market_prices

JOIN (SELECT max(mp. high) AS high, code
	FROM 
		market_prices as mp 
	WHERE 
		mp.ymd >= '2024-02-15'
		AND mp.ymd <> '2024-02-29'
		GROUP BY mp.code
	) as mt
WHERE
	market_prices.ymd = '2024-02-29' AND 
	market_prices.code = mt.code 
	AND market_prices.high > mt.high;

Table of contents 목차

평점을 남겨주세요
평점 : 2.5
총 투표수 : 1

질문 및 답글