The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
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. |
#2
|
||||
|
||||
[sql]WHERE like 'a%'[/sql]
That would get all entries where the title column starts with an 'a'. |
#3
|
||||
|
||||
if you want to ignore cases it's
[sql]WHERE UCASE(fieldname) LIKE 'A%'[/sql] |
#4
|
||||
|
||||
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
|
#5
|
||||
|
||||
Wow. Thanks for the speedy replies.
I'll definitely give it a shot. Thankies thankies! |
#6
|
||||
|
||||
Quote:
bah, maybe it's just a setting, which is changeable |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|