Jump to content

A-Z Index

- - - - -

  • Please log in to reply
2 replies to this topic

#1
jwg2s

jwg2s

    Newbie

  • Members
  • Pip
  • 2 posts
I'd like to create a A-Z index so that when a user clicks A, it lists all the rows with the title that starts with A. Can anyone point me towards a tutorial that will help me achieve this?

Thanks

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
You should be able to provide alphabetical order with "ORDER BY title", and display only titles with A with "WHERE title LIKE 'a%' ORDER BY title;"

MySQL :: MySQL 5.0 Reference Manual :: 3.3.4.4 Sorting Rows
MySQL :: MySQL 5.0 Reference Manual :: 11.5.1 String Comparison Functions

Edited by Alexander, 07 June 2011 - 07:54 AM.

Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
AKMafia001

AKMafia001

    Programmer

  • Members
  • PipPipPipPip
  • 119 posts
Alexander! isn't it "LIKE 'a%'?
As he wants to display those which starts with A. As quoted below,

jwg2s said:

I'd like to create a A-Z index so that when a user clicks A, it lists all the rows with the title that starts with A.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users