I want to display records inbetween two dates and also want to use where condition( like and deptname='Pediatry Department').
SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2
Here is an example, we have a table named data(id, name, dob,deptName.....) and we have to find the data of a person whose names starts with r and deptname is software and dob lies between two specified dates.
Here is the query for this:
select * from data where dob between '2005-12-01'and '2005-12-31' and name LIKE 'r%' and deptName='software';