Mysql query mistake on inner join tables [closed]





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







1















enter image description here



Hi, I have two tables goods and delivery, I try to get from table delivery sum of field gived_amout grouping by table goods field name. But also in the query, I need field price, but I have an error on field price



SELECT sum(I.gived_amount), P.name, P.price
FROM delivery I
INNER JOIN goods P ON P.id_g=I.id_g
GROUP BY P.name









share|improve this question















closed as off-topic by Zoe, Temani Afif, Joakim Danielson, D-Shih, greg-449 Nov 25 '18 at 11:35


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Zoe, Temani Afif, Joakim Danielson, D-Shih, greg-449

If this question can be reworded to fit the rules in the help center, please edit the question.

















  • And what is the error ? (the most important thing in your question !)

    – NoDataFound
    Nov 25 '18 at 10:56











  • Also, your GROUP BY usage is not valid. Do check this answer: stackoverflow.com/a/34115425/2469308

    – Chowkidar Madhur Bhaiya
    Nov 25 '18 at 11:00













  • mistake is following SELECT list is not in GROUP BY clause and contains nonaggregated column 'P.price'

    – Jurijs Visockis
    Nov 25 '18 at 11:05













  • Maybe delete this question then

    – Joakim Danielson
    Nov 25 '18 at 11:06











  • sorry I found the mistake :-)

    – Jurijs Visockis
    Nov 25 '18 at 11:11




















1















enter image description here



Hi, I have two tables goods and delivery, I try to get from table delivery sum of field gived_amout grouping by table goods field name. But also in the query, I need field price, but I have an error on field price



SELECT sum(I.gived_amount), P.name, P.price
FROM delivery I
INNER JOIN goods P ON P.id_g=I.id_g
GROUP BY P.name









share|improve this question















closed as off-topic by Zoe, Temani Afif, Joakim Danielson, D-Shih, greg-449 Nov 25 '18 at 11:35


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Zoe, Temani Afif, Joakim Danielson, D-Shih, greg-449

If this question can be reworded to fit the rules in the help center, please edit the question.

















  • And what is the error ? (the most important thing in your question !)

    – NoDataFound
    Nov 25 '18 at 10:56











  • Also, your GROUP BY usage is not valid. Do check this answer: stackoverflow.com/a/34115425/2469308

    – Chowkidar Madhur Bhaiya
    Nov 25 '18 at 11:00













  • mistake is following SELECT list is not in GROUP BY clause and contains nonaggregated column 'P.price'

    – Jurijs Visockis
    Nov 25 '18 at 11:05













  • Maybe delete this question then

    – Joakim Danielson
    Nov 25 '18 at 11:06











  • sorry I found the mistake :-)

    – Jurijs Visockis
    Nov 25 '18 at 11:11
















1












1








1








enter image description here



Hi, I have two tables goods and delivery, I try to get from table delivery sum of field gived_amout grouping by table goods field name. But also in the query, I need field price, but I have an error on field price



SELECT sum(I.gived_amount), P.name, P.price
FROM delivery I
INNER JOIN goods P ON P.id_g=I.id_g
GROUP BY P.name









share|improve this question
















enter image description here



Hi, I have two tables goods and delivery, I try to get from table delivery sum of field gived_amout grouping by table goods field name. But also in the query, I need field price, but I have an error on field price



SELECT sum(I.gived_amount), P.name, P.price
FROM delivery I
INNER JOIN goods P ON P.id_g=I.id_g
GROUP BY P.name






mysql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 19:27









Valerian Pereira

5251513




5251513










asked Nov 25 '18 at 10:54









Jurijs VisockisJurijs Visockis

66127




66127




closed as off-topic by Zoe, Temani Afif, Joakim Danielson, D-Shih, greg-449 Nov 25 '18 at 11:35


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Zoe, Temani Afif, Joakim Danielson, D-Shih, greg-449

If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by Zoe, Temani Afif, Joakim Danielson, D-Shih, greg-449 Nov 25 '18 at 11:35


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Zoe, Temani Afif, Joakim Danielson, D-Shih, greg-449

If this question can be reworded to fit the rules in the help center, please edit the question.













  • And what is the error ? (the most important thing in your question !)

    – NoDataFound
    Nov 25 '18 at 10:56











  • Also, your GROUP BY usage is not valid. Do check this answer: stackoverflow.com/a/34115425/2469308

    – Chowkidar Madhur Bhaiya
    Nov 25 '18 at 11:00













  • mistake is following SELECT list is not in GROUP BY clause and contains nonaggregated column 'P.price'

    – Jurijs Visockis
    Nov 25 '18 at 11:05













  • Maybe delete this question then

    – Joakim Danielson
    Nov 25 '18 at 11:06











  • sorry I found the mistake :-)

    – Jurijs Visockis
    Nov 25 '18 at 11:11





















  • And what is the error ? (the most important thing in your question !)

    – NoDataFound
    Nov 25 '18 at 10:56











  • Also, your GROUP BY usage is not valid. Do check this answer: stackoverflow.com/a/34115425/2469308

    – Chowkidar Madhur Bhaiya
    Nov 25 '18 at 11:00













  • mistake is following SELECT list is not in GROUP BY clause and contains nonaggregated column 'P.price'

    – Jurijs Visockis
    Nov 25 '18 at 11:05













  • Maybe delete this question then

    – Joakim Danielson
    Nov 25 '18 at 11:06











  • sorry I found the mistake :-)

    – Jurijs Visockis
    Nov 25 '18 at 11:11



















And what is the error ? (the most important thing in your question !)

– NoDataFound
Nov 25 '18 at 10:56





And what is the error ? (the most important thing in your question !)

– NoDataFound
Nov 25 '18 at 10:56













Also, your GROUP BY usage is not valid. Do check this answer: stackoverflow.com/a/34115425/2469308

– Chowkidar Madhur Bhaiya
Nov 25 '18 at 11:00







Also, your GROUP BY usage is not valid. Do check this answer: stackoverflow.com/a/34115425/2469308

– Chowkidar Madhur Bhaiya
Nov 25 '18 at 11:00















mistake is following SELECT list is not in GROUP BY clause and contains nonaggregated column 'P.price'

– Jurijs Visockis
Nov 25 '18 at 11:05







mistake is following SELECT list is not in GROUP BY clause and contains nonaggregated column 'P.price'

– Jurijs Visockis
Nov 25 '18 at 11:05















Maybe delete this question then

– Joakim Danielson
Nov 25 '18 at 11:06





Maybe delete this question then

– Joakim Danielson
Nov 25 '18 at 11:06













sorry I found the mistake :-)

– Jurijs Visockis
Nov 25 '18 at 11:11







sorry I found the mistake :-)

– Jurijs Visockis
Nov 25 '18 at 11:11














1 Answer
1






active

oldest

votes


















0














You should use GROUP BY P.name, P.price in order for the sql query to be syntactically correct.



According to sql you should put into the GROUP BY clause all non grouping columns (P.name and P.price in your case).






share|improve this answer
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You should use GROUP BY P.name, P.price in order for the sql query to be syntactically correct.



    According to sql you should put into the GROUP BY clause all non grouping columns (P.name and P.price in your case).






    share|improve this answer






























      0














      You should use GROUP BY P.name, P.price in order for the sql query to be syntactically correct.



      According to sql you should put into the GROUP BY clause all non grouping columns (P.name and P.price in your case).






      share|improve this answer




























        0












        0








        0







        You should use GROUP BY P.name, P.price in order for the sql query to be syntactically correct.



        According to sql you should put into the GROUP BY clause all non grouping columns (P.name and P.price in your case).






        share|improve this answer















        You should use GROUP BY P.name, P.price in order for the sql query to be syntactically correct.



        According to sql you should put into the GROUP BY clause all non grouping columns (P.name and P.price in your case).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 25 '18 at 11:51

























        answered Nov 25 '18 at 11:16









        adrhcadrhc

        515414




        515414

















            這個網誌中的熱門文章

            Hercules Kyvelos

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud