![]() |
Search [alphabetically, first letter] a | b | c | d | e.. ?
I'm new to the SQL searching thing and I've been trying to figure out a way to allow a user search via the first letter on a certain table, such as "title" or "topic" or something.
So by a user clicking a or b or c or d.. so on and so forth.. The result would bring back and alphabetical order of topics with -just- that letter (such as the example below). If user clicks A, result is: alien alligator ant art asp If user clicks B, result is: beast bite brake butter .. I'm assuming to get the function to go alphabetical, it'd be GROUP BY or ORDER BY with an ASC or DESC, but the searching via a first letter is kind of killing me. ;) |
[sql]WHERE like 'a%'[/sql]
That would get all entries where the title column starts with an 'a'. |
if you want to ignore cases it's
[sql]WHERE UCASE(fieldname) LIKE 'A%'[/sql] |
It normally seems to ignore the case anyway, at least on 4.0.15, I just tried and got A and a returned. Although normally I'd put a case check in to be sure ;)
|
Wow. Thanks for the speedy replies. :)
I'll definitely give it a shot. Thankies thankies! |
Quote:
bah, maybe it's just a setting, which is changeable ;) |
All times are GMT. The time now is 07:02 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|