Click here to Skip to main content
15,877,360 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
id trip_code start_date end_date
1 000001 13/03/2012 31/03/2012
2 000002 14/03/2012 28/03/2012

and my departure date is 15/03/2012

how to show the trip_code(000001 and 000002) as long as departure date is between start date and end date?

Try this:
select trip_code from Trips where @departure_date > start_date and @departure_date < end_date

Good luck!
Share this answer
N Haque 13-Mar-12 8:38am    
I think It will be working..
Use this query:
SELECT trip_code FROM <tablename>
WHERE departure_date between @startDate AND @endDate
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900