tags:

views:

33

answers:

2

i am using mysql.

this query is working fine:

SELECT * FROM tablename where Date >'20091109' and id='11';

but below this query does not return any thing.

SELECT * FROM tablename where Date between ('20091109' and '20081010') and id='11';

+2  A: 
between ('20091109' and '20081010') 

This is anything after 9th Nov 2008 and before 10th Oct 2008. Of course if show nothing.

Do you mean this which is 10 Oct 2008 to 8th Nov 2009 inclusive

Date >= '20081010' AND Date < '20091109'

or this which is 10 Oct 2008 to 9th Nov 2009 inclusive

Date >= '20081010' AND Date < '20091110'

Edit: Removed SQL Server references

gbn
+2  A: 
   SELECT * FROM 
   tablename 
   where Date between '20081010' and '20091109' 
   and id='11';
Michael Pakhantsov