I want to create a SELECT statement to retrieve records within a
range. Here is what I have so far:
For all records that start with "A" in field HH_ID.
SELECT * FROM `Z_HH_Prototype` WHERE `HH_ID` like '%A_____%' -- This
returns all records that begin with "A", followed by 5 other characters
no matter what they are (91 records in this case). I'd like to be able
to use something like BETWEEN, but it appears that I don't understand
how this comparison operator works.
SELECT * FROM `Z_HH_Prototype` WHERE `HH_ID` BETWEEN '%A_____%' and
'%B_____%' returns 0 rows, as does this statement
SELECT * FROM `Z_HH_Prototype` WHERE `HH_ID` > '%A_____%' and <
'%B_____%' (yields a SQL syntax error) as does SELECT * FROM
`Z_HH_Prototype` WHERE `HH_ID` > 'A_____' AND < 'B_____'
Obviously, I don't understand how to retrieve a range of records.
Help!!! Incidentally, I know that the field HH_ID only has six characters.
Andrew L.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql