MySQL Forums
Forum List  »  Full-Text Search

AND statement fails where each works individually
Posted by: Jan Millar
Date: July 22, 2012 10:48AM

I have a table (ENGINE=NDB) where the primary key is 'szId VARCHAR(85) CHARSET ascii PRIMARY KEY'.

I use to store failed login details where the key is e.g. '192.168.0.3' or '192.168.0.3&Fred'.

I need to find all the records beginning e.g. '192.168.0.3'.

"SELECT * FROM Tbl WHERE szId >= '192.168.0.3'" returns the record '192.168.0.3&Fred'.

"SELECT * FROM Tbl WHERE szId < '192.168.0.4'" returns the record '192.168.0.3&Fred'.

"SELECT * FROM Tbl WHERE szId >= '192.168.0.3' AND szId < '192.168.0.4'" fails to return '192.168.0.3&Fred'.

This will however return a record with key '192.168.0.3'.

What do I need to do to return all strings *beginning* 192.168.0.3 and < *beginning* 192.168.0.4?

Thanks

Jan

Options: ReplyQuote


Subject
Views
Written By
Posted
AND statement fails where each works individually
3390
July 22, 2012 10:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.