Write a query to find out the data between ranges?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Nov 13, 2022, 12:50 PM EST
You mean date range (inclusive end date)
then
select * from table where dateCol>=Mindate and dateCol<=Maxdateif you want to get date from min and less than max date then use between instead
select * from table where datecol between MinDate and MaxDateJignesh KumarRank #91 · 22.9K reputationPosted Nov 14, 2022, 12:28 AM EST
Hi Naresh,
Please use this query to find range data but it will cosider time as well for StartDate and EndDate,
Select from yourTableName where @Date BETWEEN @StartDate AND @EndDateIf you want to include both date in your result then you can apply >= and <= in your where caluse for your date,
select * from youRTableName where CAST(@Date AS date) >= CAST(@FromDate AS date) and CAST(@Date AS date) <= CAST(@ToDate AS date)Brahma Prakash ShuklaRank #633 · 3.8K reputationPosted Nov 26, 2022, 9:12 AM EST
https://www.simplilearn.com/tutorials/sql-tutorial/sql-between