1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

SQL Query issue

Discussion in 'Programming' started by Notting, Oct 19, 2007.

  1. #1
    Query:


    SELECT members.mem_ID,
    CONCAT(members.firstname, ' ', UPPER(members.familyname) AS name
    FROM members
    WHERE members.active = 'Y'
    ORDER BY members.familyname

    returns error message:
    SEMrush
    [​IMG]

    Can anyone work out what the problem here is?

    Thanks
    Notting
     
    Notting, Oct 19, 2007 IP
    SEMrush
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Try this.
    
    SELECT members.mem_ID,
    CONCAT(members.firstname, ' ', UPPER(members.familyname)) AS name
    FROM members
    WHERE members.active = 'Y'
    ORDER BY members.familyname
    
    Code (sql):
     
    nico_swd, Oct 19, 2007 IP
  3. Forrest

    Forrest Peon

    Messages:
    501
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #3
    My guess is you can't use "name" as an alias; it's probably reserved. Although the evil monkey is right, you're missing a closing parenthesis.
     
    Forrest, Oct 20, 2007 IP
  4. mhaye_01

    mhaye_01 Banned

    Messages:
    395
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    what;s the use of using "members.mem_id and other if you are just calling from one table..
    your are joining two fieldnames but from same table right?
     
    mhaye_01, Oct 20, 2007 IP
  5. mhaye_01

    mhaye_01 Banned

    Messages:
    395
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    SELECT mem_ID,
    CONCAT(firstname, ' ', UPPER(familyname)) AS name
    FROM members
    WHERE active = 'Y'
    ORDER BY familyname

    i think this will run t0o
     
    mhaye_01, Oct 20, 2007 IP
    Alexander the Great likes this.