Click here to Skip to main content
16,000,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear,

Suppose if i have InvoiceTable consist of InvoiceNo, InvoiceStartDate, InvoiceEndDate Column then how to put the SQL between condition on InvoiceStartDate and InvoiceEndDate Below is the query of only one column.



SQL
select InvoiceNo  from InvoiceTable where
             InvoiceEndDate Date between '2011/02/25' and '2011/02/27'



Please help on this

Thanks
Basit.
Posted
Updated 17-Mar-15 22:26pm
v2

I'm not quite sure what you mean by "how to put the SQL between condition on InvoiceStartDate and InvoiceEndDate" but I guess one of these will be what you want:

SQL
select InvoiceNo from InvoiceTable
where InvoiceEndDate between '2011/02/25' and '2011/02/27'
and InvoiceStartDate between '..../../..' and '..../../..';


SQL
select InvoiceNo from InvoiceTable
where '..../../..' between InvoiceStartDate and InvoiceEndDate;
 
Share this answer
 
Comments
Abhinav S 18-Mar-15 4:35am    
Good answer.
[no name] 18-Mar-15 4:38am    
Thank you! :)
Use an AND.
Example
SQL
select InvoiceNo  from InvoiceTable where
             (InvoiceEndDate Date between '2011/02/25' and '2011/02/27') and 
             (InvoiceStartDate Date between '2011/02/25' and '2011/02/27')
 
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