I need SQL query to find between two date and another column by name

847 views Asked by At
SELECT * 
FROM claz 
WHERE student AND (BETWEEN date AND date) 

I have this one table claz, and I need to search to find student records between date periods

4

There are 4 answers

3
Rahul Tripathi On BEST ANSWER

You may try to use it like this:

SELECT *  
FROM claz  
WHERE student = 'somevalue'
  AND date_column BETWEEN '2013/02/25' AND '2013/02/27'

or like this:

SELECT *  
FROM claz  
WHERE student = 'somevalue'
  AND date_column >'2013/02/25' AND date_column <'2013/02/27'

But it not very clear what you are trying to achieve

0
Armunin On

Try:

SELECT * FROM claz
WHERE student = ?
AND date BETWEEN date1 AND date2;

Not sure thought what your student should match and what name your date-column has. Couldn't test it, as I am not near my DB at the moment.

0
subash On

try this..

SELECT * FROM claz WHERE student = 'BG' AND date < maxdate AND date > mindate;
0
Rajika Nanayakkara On

try this

SELECT * 
FROM claz 
WHERE student='name' 
  AND date BETWEEN 'date one' AND 'date two'