shadedecho
Programmer
I am having a great deal of difficulty finding sufficient documentation on the "BETWEEN ... AND" operator functionality in MySQL, in particular, how (if possible) to use it with a variable.
Before I ask that question though, a little ground work: You may be familiar with the ability to query MySQL without referencing a table, such as:
SELECT TO_DAYS('2002-01-15') AS 'datevar'
would return:
datevar
_______
731230
I would like to use this ability as well as "BETWEEN ... AND" to have MySQL return a result set with a range of values... for instance, something like this:
SELECT @a WHERE @a BETWEEN 3 AND 8
and have MySQL return a result set like this:
3
4
5
6
7
8
Can anyone help me with how I would syntactically structure such a query?
Before I ask that question though, a little ground work: You may be familiar with the ability to query MySQL without referencing a table, such as:
SELECT TO_DAYS('2002-01-15') AS 'datevar'
would return:
datevar
_______
731230
I would like to use this ability as well as "BETWEEN ... AND" to have MySQL return a result set with a range of values... for instance, something like this:
SELECT @a WHERE @a BETWEEN 3 AND 8
and have MySQL return a result set like this:
3
4
5
6
7
8
Can anyone help me with how I would syntactically structure such a query?