Home > database >  Segmented query
Segmented query

Time:09-24

Requirements, check 1 months, 13 to 14 PM in 30 and the 18 PM to 9 PM the next day,
Please the great god guide
I write as if not, my statement is as follows, time ignore


SELECT * FROM Record
WHERE
Datediff (month, Times, getdate ())=0
AND (
CONVERT (varchar (8), Times, 114) BETWEEN '08:30:00' and '12:00:00'
Or
CONVERT (varchar (8), Times, 114) BETWEEN '12:30:00' and '17:00:00'
)

CodePudding user response:

No one under the guidance of yao, ,,,,,,,

CodePudding user response:

 SELECT * 
The FROM Record
WHERE - you wrote in the same month, your requirement is one month, the same logic?
DATEDIFF (MONTH, Times, GETDATE ())=0
AND (
13 to 14 PM - 30
CONVERT (VARCHAR (5) Times, 114) BETWEEN '13:00' AND 'passion'
OR
- 18 points to 9 PM the next day
CONVERT (VARCHAR (5) Times, 114) BETWEEN '18:00' AND '23:59'
OR
CONVERT (VARCHAR (5) Times, 114) BETWEEN '00:00' AND '09:00'
)

CodePudding user response:

Don't understand the moderator, a little fuzzy,
  • Related