Announcement

Collapse
No announcement yet.

invalid use of group function mysql 4

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • invalid use of group function mysql 4

    Habe folgende Anweisung in meiner Entwicklungsumgebung (MySQL 5) geschrieben und dort funktioniert sie:

    HTML Code:
    	SELECT COUNT(tx_tischler_anfrage.uid),
    tx_tischler_products.title, 
    be_users.username,
    CONCAT('<div style="background-color: green;width:',COUNT(tx_tischler_anfrage.uid)*5,'px;border-bottom: 1px solid white;">&nbsp;</div>')
    FROM tx_tischler_anfrage INNER JOIN tx_tischler_products ON tx_tischler_anfrage.uid_products = tx_tischler_products.uid, be_users
    WHERE
    tx_tischler_products.be_user_uid = be_users.uid
    GROUP BY tx_tischler_anfrage.uid_products
    ORDER BY COUNT(tx_tischler_anfrage.uid) DESC
    In MySQL 4 (Webserver) funtioniert das ganze nicht mehr - ich bekomme einen Fehler: ERROR 1111 : Invalid use of group function. Gibt es dafür eine MySQL 4-konforme Lösung?

    Vielen Dank für eure Hinweise.

    Ingo

  • #2
    vielleicht so:
    Code:
    SELECT COUNT(tx_tischler_anfrage.uid),
    tx_tischler_products.title, 
    be_users.username,
    CONCAT('<div style="background-color: green;width:',COUNT(tx_tischler_anfrage.uid)*5,'px;border-bottom: 1px solid white;">&nbsp;</div>')
    FROM tx_tischler_anfrage 
    INNER JOIN tx_tischler_products ON tx_tischler_anfrage.uid_products = tx_tischler_products.uid, be_users
    WHERE tx_tischler_products.be_user_uid = be_users.uid
    GROUP BY tx_tischler_products.title, 
    be_users.username
    ORDER BY COUNT(tx_tischler_anfrage.uid) DESC

    Comment


    • #3
      Hat leider nichts gebracht! Trotzdem Danke!

      Comment


      • #4
        Habs nun selber gefunden!

        So funktionierts:

        PHP Code:
        SELECT COUNTtx_tischler_anfrage.uid ) AS ntx_tischler_products.titlebe_users.usernameCONCAT'<div style="background-color: green;width:'COUNTtx_tischler_anfrage.uid ) *5'px;border-bottom: 1px solid white;">&nbsp;</div>' ) AS chart
        FROM tx_tischler_anfrage
        INNER JOIN tx_tischler_products ON tx_tischler_anfrage
        .uid_products tx_tischler_products.uidbe_users
        WHERE tx_tischler_products
        .be_user_uid be_users.uid
        GROUP BY tx_tischler_anfrage
        .uid_products
        ORDER BY n DESC
        LIMIT 0 
        30 
        Anscheinend darf man in ORDER BY in MySQL 4 keine COUNT()-Funktion verwenden.

        Comment

        Working...
        X