Results 1 to 3 of 3

Thread: Limits of GROUP BY??

  1. #1
    Join Date
    Aug 2005
    Posts
    174
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Limits of GROUP BY??

    Hello,

    I have 3 tables in a database, the first being a list of handsets, the second a list of tariffs and the third a list of the deals..

    handsets table
    Code:
    handsetid|handsetname|handsetmake
    tariff table
    Code:
    tariffid|tariffname
    deals table
    Code:
    dealsid|dealsinfo|tariffid|handsetid
    I am planning on using Join Left to join the tables together which I shouldnt have any problems doing..

    My problem here is that I want to use GROUP BY on the first 2 characters of the tariffid field..

    an example of the tarrifid
    Code:
    o2xxx, o2yyy, o2zzz, tmxxx, tmyyyy
    Would this be at all possible?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Certainly: ... GROUP BY SUBSTRING(tariffid, 0, 2)
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. The Following User Says Thank You to Twey For This Useful Post:

    bugskiller (01-05-2009)

  4. #3
    Join Date
    Aug 2005
    Posts
    174
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    twey, once again.. thank you VERY VERY much!

    You have saved me hours of work here!

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
  •