SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SELECT value FROM table WHERE value=A ?

    Hello!

    I thought this was going to be easy and thus never spend much time thinking about it until the second i had to implement it!!

    I need to be able to sort by letters.
    For example, i have 10.000 companys in the database and i want to have a query which will return ONLY those companys that start with a certain given letter.

    But, how to get it done?

    I wouldnt even know how to tell MySQL to only look at the first letter of each value...

    Anyone had to do this before?
    Help would be appreciated (or hints, tips ).

    Best regards from Vienna at 03:07 in the morning *yawn*,
    datune

  2. #2
    SitePoint Guru dragonhawk's Avatar
    Join Date
    Apr 2002
    Location
    Melbourne
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how about something like:

    SELECT Company FROM $table WHERE Company='a%'

    That would mean that all company's beginning with a will be shown.

    I haven't really tested this but I remember using it before... It's either a % or a * I think...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •