Displaying data by letter

Discussion in 'Databases' started by phantomddl, May 23, 2007.

  1. #1
    i am making a lyrics script, lets say i want the songs that start with "a" letter get listed, what query do i need to run for it?
     
    phantomddl, May 23, 2007 IP
  2. turiel

    turiel Peon

    Messages:
    148
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SELECT * FROM songs WHERE songs.name LIKE 'A%'

    or

    SELECT * from songs WHERE LEFT(songs.name,1)='a'

    If you have an index on the song name column then the 2nd query will be faster for sure.
     
    turiel, May 23, 2007 IP
    phantomddl likes this.
  3. phantomddl

    phantomddl Well-Known Member

    Messages:
    2,856
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    160
    Articles:
    15
    #3
    thanx :) will try
     
    phantomddl, May 23, 2007 IP