SQL 은 전날, 1 월, 1 년 의 시간 을 가 져 옵 니 다.
1927 단어 데이터 뱅 크
_______________________________________
월요일 부터 일요일 까지 일주일 간 의 수금 이다.
ASA: set DATEFIRST 1 --매주 첫 날 은 월요일 selectsum (isnull (cash. act amt, 0) 을 이번 수금 으로 설정 합 니 다. cash.customer_id as 고객 번호 from cash where cash.approved='Y' and cash.trans_date between convert (varchar (10), dateadd (day, 1 - datepart (weekday, getdate (), getdate (), 120) and convert (varchar (10), dateadd (day, 7 - datepart (weekday, getdate (), 120) -- 첫날 과 마지막 날
SQL 은 다음 과 같 습 니 다.
이번 주 마지막 날 꺼 내.
select DATEADD(WK,DATEDIFF(WK,0,GETDATE()),6)
selection sum (isnull (cash. act amt, 0) 을 이번 수금 으로, cash.customer_id as 고객 번호 from cash where cash. approved = 'Y' and datediff (week, cash. trans date - 1, getdate ()) = 0 group
이번 주 일요일 부터 토요일 까지 일주일 select * from tb where datediff (week, 시간 필드, getdate () = 0 지난주 select * from tb where datediff (week, 시간 필드, getdate () = 1 다음 주 select * from tb where datediff (week, 시간 구간, getdate ()))= - 1 --------------------------------------------------------------------------------------------------------------------------------------------------------------------= 0 -- 다음 달 선택 * 부터 TableName Where DateDiff (mm, GetDate (), DateTimCol) = 1 어제: dateadd (day, - 1, getdate () 내일: dateadd (day, 1, getdate () 지난달: month (dateadd (month, - 1, getdate ()) 이번 달: month (getdate () 다음 달: month (dateadd (month, 1, getdate))() = 1 -- 내일 Select * From TableName Where DateDiff (dd, GetDate (), DateTimCol) = 1 -- 최근 7 일 Select * From TableName Where DateDiff (dd, DateTimCol, GetDate ()) < = 7 -- 추 후 7 일 --------------------------------------------------------------------------- 현재 년 select 제출 날짜, datepart (year, getdate () as 현재 년 from 공급 자 자료 표 전년 도 select 제출 날짜, datepart (year, getdate () - 1 as 현재 년 from 공급 자 자료 표 후 1 년 select 제출 날짜, datepart (year, getdate () + 1 as 현재 년 from 공급 자 자료 표
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
nginx websocket ip_해시 규칙프로젝트 를 다운로드 한 후 서로 다른 네트워크 에 각각 이 demo 프로젝트 를 배치 합 니 다. 프로젝트 에서 환경 변수 에 따라 시스템 변 수 를 설정 합 니 다. spring.profiles.active=de...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.