Why do i keep getting the same error message on SQLSQL injection that gets around mysql_real_escape_string()Reference - What does this error mean in PHP?Error related to only_full_group_by when executing a query in MySqlerror in sql when using group byMysql Query - incompatible with sql_mode=only_full_group_bySQL Giving #1055 error when using GROUP_CONCATAfter upgrading to mysql 5.7.21: incompatible with sql_mode=only_full_group_byGroupBy Laravel MySql QueryLaravel Eloquent groupByHow do I merge 4 tables and group by user_id

What is GPS' 19 year rollover and does it present a cybersecurity issue?

Some basic questions on halt and move in Turing machines

New order #4: World

What happens when a metallic dragon and a chromatic dragon mate?

Is domain driven design an anti-SQL pattern?

Is "plugging out" electronic devices an American expression?

Is Social Media Science Fiction?

Domain expired, GoDaddy holds it and is asking more money

If a centaur druid Wild Shapes into a Giant Elk, do their Charge features stack?

What is the command to reset a PC without deleting any files

Does it makes sense to buy a new cycle to learn riding?

How can I fix this gap between bookcases I made?

"listening to me about as much as you're listening to this pole here"

What does 'script /dev/null' do?

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

Is this food a bread or a loaf?

Why is making salt water prohibited on Shabbat?

Can I legally use front facing blue light in the UK?

What do the Banks children have against barley water?

Why is the design of haulage companies so “special”?

Is a car considered movable or immovable property?

Travelling to Edinburgh from India

Manga about a female worker who got dragged into another world together with this high school girl and she was just told she's not needed anymore

Why do UK politicians seemingly ignore opinion polls on Brexit?



Why do i keep getting the same error message on SQL


SQL injection that gets around mysql_real_escape_string()Reference - What does this error mean in PHP?Error related to only_full_group_by when executing a query in MySqlerror in sql when using group byMysql Query - incompatible with sql_mode=only_full_group_bySQL Giving #1055 error when using GROUP_CONCATAfter upgrading to mysql 5.7.21: incompatible with sql_mode=only_full_group_byGroupBy Laravel MySql QueryLaravel Eloquent groupByHow do I merge 4 tables and group by user_id






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Overview:Write a SELECT statement that summarizes the guitar shop’s orders



GROUP BY order_id
HAVING MAX(discount_amount)>500
ORDER BY order_id ASC


I keep getting this error message: Error code 1055. Expression #3 of select list is not










share|improve this question
























  • You typically GROUP BY the same columns as you SELECT, except those who are arguments to set functions.

    – jarlh
    Mar 8 at 7:12











  • SQL queries usually start with SELECT, not GROUP BY.

    – Gordon Linoff
    Mar 8 at 13:00

















0















Overview:Write a SELECT statement that summarizes the guitar shop’s orders



GROUP BY order_id
HAVING MAX(discount_amount)>500
ORDER BY order_id ASC


I keep getting this error message: Error code 1055. Expression #3 of select list is not










share|improve this question
























  • You typically GROUP BY the same columns as you SELECT, except those who are arguments to set functions.

    – jarlh
    Mar 8 at 7:12











  • SQL queries usually start with SELECT, not GROUP BY.

    – Gordon Linoff
    Mar 8 at 13:00













0












0








0








Overview:Write a SELECT statement that summarizes the guitar shop’s orders



GROUP BY order_id
HAVING MAX(discount_amount)>500
ORDER BY order_id ASC


I keep getting this error message: Error code 1055. Expression #3 of select list is not










share|improve this question
















Overview:Write a SELECT statement that summarizes the guitar shop’s orders



GROUP BY order_id
HAVING MAX(discount_amount)>500
ORDER BY order_id ASC


I keep getting this error message: Error code 1055. Expression #3 of select list is not







mysql sql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 7:19







Candy Buruss

















asked Mar 8 at 7:03









Candy BurussCandy Buruss

11




11












  • You typically GROUP BY the same columns as you SELECT, except those who are arguments to set functions.

    – jarlh
    Mar 8 at 7:12











  • SQL queries usually start with SELECT, not GROUP BY.

    – Gordon Linoff
    Mar 8 at 13:00

















  • You typically GROUP BY the same columns as you SELECT, except those who are arguments to set functions.

    – jarlh
    Mar 8 at 7:12











  • SQL queries usually start with SELECT, not GROUP BY.

    – Gordon Linoff
    Mar 8 at 13:00
















You typically GROUP BY the same columns as you SELECT, except those who are arguments to set functions.

– jarlh
Mar 8 at 7:12





You typically GROUP BY the same columns as you SELECT, except those who are arguments to set functions.

– jarlh
Mar 8 at 7:12













SQL queries usually start with SELECT, not GROUP BY.

– Gordon Linoff
Mar 8 at 13:00





SQL queries usually start with SELECT, not GROUP BY.

– Gordon Linoff
Mar 8 at 13:00












3 Answers
3






active

oldest

votes


















0














use sum(quantity) as you are using aggregated function you've to use this also in aggregated way other wise it's need to added in group by clause



SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
sum(quantity) AS order_total, MAX(discount_amount) AS max_item_discount
FROM order_items
GROUP BY order_id
HAVING MAX(discount_amount)>500
ORDER BY order_id ASC





share|improve this answer






























    0














    use quantity in group by as your engine ONLY_FULL_GROUP_BY



     SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
    quantity AS order_total, MAX(discount_amount) AS max_item_discount
    FROM order_items
    GROUP BY order_id,quantity
    HAVING MAX(discount_amount)>500
    ORDER BY order_id ASC


    other wise use quantity inside aggregation sum((item_price - discount_amount) * quantity)






    share|improve this answer






























      0














      You have the column quantity not in group by nut could be you need move the column inside te sum for item_price - discount_amount



       SELECT order_id
      , COUNT(*) AS num_items
      , SUM((item_price - discount_amount) * quantity ) AS order_total
      , MAX(discount_amount) AS max_item_discount
      FROM order_items
      GROUP BY order_id
      HAVING MAX(discount_amount)>500
      ORDER BY order_id ASC





      share|improve this answer























        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058282%2fwhy-do-i-keep-getting-the-same-error-message-on-sql%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        0














        use sum(quantity) as you are using aggregated function you've to use this also in aggregated way other wise it's need to added in group by clause



        SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
        sum(quantity) AS order_total, MAX(discount_amount) AS max_item_discount
        FROM order_items
        GROUP BY order_id
        HAVING MAX(discount_amount)>500
        ORDER BY order_id ASC





        share|improve this answer



























          0














          use sum(quantity) as you are using aggregated function you've to use this also in aggregated way other wise it's need to added in group by clause



          SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
          sum(quantity) AS order_total, MAX(discount_amount) AS max_item_discount
          FROM order_items
          GROUP BY order_id
          HAVING MAX(discount_amount)>500
          ORDER BY order_id ASC





          share|improve this answer

























            0












            0








            0







            use sum(quantity) as you are using aggregated function you've to use this also in aggregated way other wise it's need to added in group by clause



            SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
            sum(quantity) AS order_total, MAX(discount_amount) AS max_item_discount
            FROM order_items
            GROUP BY order_id
            HAVING MAX(discount_amount)>500
            ORDER BY order_id ASC





            share|improve this answer













            use sum(quantity) as you are using aggregated function you've to use this also in aggregated way other wise it's need to added in group by clause



            SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
            sum(quantity) AS order_total, MAX(discount_amount) AS max_item_discount
            FROM order_items
            GROUP BY order_id
            HAVING MAX(discount_amount)>500
            ORDER BY order_id ASC






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 8 at 7:05









            fa06fa06

            18.9k21019




            18.9k21019























                0














                use quantity in group by as your engine ONLY_FULL_GROUP_BY



                 SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
                quantity AS order_total, MAX(discount_amount) AS max_item_discount
                FROM order_items
                GROUP BY order_id,quantity
                HAVING MAX(discount_amount)>500
                ORDER BY order_id ASC


                other wise use quantity inside aggregation sum((item_price - discount_amount) * quantity)






                share|improve this answer



























                  0














                  use quantity in group by as your engine ONLY_FULL_GROUP_BY



                   SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
                  quantity AS order_total, MAX(discount_amount) AS max_item_discount
                  FROM order_items
                  GROUP BY order_id,quantity
                  HAVING MAX(discount_amount)>500
                  ORDER BY order_id ASC


                  other wise use quantity inside aggregation sum((item_price - discount_amount) * quantity)






                  share|improve this answer

























                    0












                    0








                    0







                    use quantity in group by as your engine ONLY_FULL_GROUP_BY



                     SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
                    quantity AS order_total, MAX(discount_amount) AS max_item_discount
                    FROM order_items
                    GROUP BY order_id,quantity
                    HAVING MAX(discount_amount)>500
                    ORDER BY order_id ASC


                    other wise use quantity inside aggregation sum((item_price - discount_amount) * quantity)






                    share|improve this answer













                    use quantity in group by as your engine ONLY_FULL_GROUP_BY



                     SELECT order_id, COUNT(*) AS num_items, SUM(item_price - discount_amount) * 
                    quantity AS order_total, MAX(discount_amount) AS max_item_discount
                    FROM order_items
                    GROUP BY order_id,quantity
                    HAVING MAX(discount_amount)>500
                    ORDER BY order_id ASC


                    other wise use quantity inside aggregation sum((item_price - discount_amount) * quantity)







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 8 at 7:06









                    Zaynul Abadin TuhinZaynul Abadin Tuhin

                    18.9k31135




                    18.9k31135





















                        0














                        You have the column quantity not in group by nut could be you need move the column inside te sum for item_price - discount_amount



                         SELECT order_id
                        , COUNT(*) AS num_items
                        , SUM((item_price - discount_amount) * quantity ) AS order_total
                        , MAX(discount_amount) AS max_item_discount
                        FROM order_items
                        GROUP BY order_id
                        HAVING MAX(discount_amount)>500
                        ORDER BY order_id ASC





                        share|improve this answer



























                          0














                          You have the column quantity not in group by nut could be you need move the column inside te sum for item_price - discount_amount



                           SELECT order_id
                          , COUNT(*) AS num_items
                          , SUM((item_price - discount_amount) * quantity ) AS order_total
                          , MAX(discount_amount) AS max_item_discount
                          FROM order_items
                          GROUP BY order_id
                          HAVING MAX(discount_amount)>500
                          ORDER BY order_id ASC





                          share|improve this answer

























                            0












                            0








                            0







                            You have the column quantity not in group by nut could be you need move the column inside te sum for item_price - discount_amount



                             SELECT order_id
                            , COUNT(*) AS num_items
                            , SUM((item_price - discount_amount) * quantity ) AS order_total
                            , MAX(discount_amount) AS max_item_discount
                            FROM order_items
                            GROUP BY order_id
                            HAVING MAX(discount_amount)>500
                            ORDER BY order_id ASC





                            share|improve this answer













                            You have the column quantity not in group by nut could be you need move the column inside te sum for item_price - discount_amount



                             SELECT order_id
                            , COUNT(*) AS num_items
                            , SUM((item_price - discount_amount) * quantity ) AS order_total
                            , MAX(discount_amount) AS max_item_discount
                            FROM order_items
                            GROUP BY order_id
                            HAVING MAX(discount_amount)>500
                            ORDER BY order_id ASC






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 8 at 7:06









                            scaisEdgescaisEdge

                            97.5k105272




                            97.5k105272



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058282%2fwhy-do-i-keep-getting-the-same-error-message-on-sql%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

                                Алба-Юлія

                                Захаров Федір Захарович