Loading ...
Sorry, an error occurred while loading the content.
 

Re: [php4india] {Query} problem in mysql

Expand Messages
  • raja mohamed
    Hi Loke, do u want the result for amount 3 or sum(amount). if u want sum(amount) use Group by or u want amount 3 just use where condition otherwise paste ur
    Message 1 of 11 , May 31, 2007
      Hi Loke,
      do u want the result for amount > 3 or sum(amount). if u want sum(amount) use Group by or u want amount >3 just use where condition

      otherwise paste ur query here. it will helpful for figure out the error.
       
      With Regards,
      Raja Mohamed.S


      ----- Original Message ----
      From: Pritesh Loke <priteshloke@...>
      To: "bang-phpug@yahoogroups.com" <bang-phpug@yahoogroups.com>; "php4india@yahoogroups.com" <php4india@yahoogroups.com>; "php_and_mysql@yahoogroups.com" <php_and_mysql@yahoogroups.com>
      Sent: Thursday, 31 May, 2007 6:03:19 PM
      Subject: [php4india] {Query} problem in mysql

      Hello To all
                         hay pls checked this attach image i have big problem in mysql
      i have to select id which sum(amount) is greater then 3 so i write query like
      select id from sss having sum(amount)>3

      but not working any pls body tell me the solution as soon as possible.

      Thank you.


      PML


      Don't be flakey. Get Yahoo! Mail for Mobile and
      always stay connected to friends.




      Download prohibited? No problem! CHAT from any browser, without download.
    • Udaya kumar
      Hi Pritesh Lokesh, First you have to listen onething while using SUM function in SQLs. That is, If you want to use SUM or AVERAGE function in sql then you have
      Message 2 of 11 , May 31, 2007
        Hi Pritesh Lokesh,

        First you have to listen onething while using SUM function in SQLs. That is, If you want to use SUM or AVERAGE function in sql then you have to use GROUP BY column_name in that sql. But in your query, you have missed that one.

        If you want to take all users those who have more than amount 3 then you can use the following...

        SELECT id FROM <table_name> WHERE SUM(amount) > 3 GROUP BY user_id

        Suppose if you want to identify each having more than amount 3 then you can follow this...

        SELECT id FROM <table_name> WHERE amount > 3

        If you have any doubt, mail to me... i will clarify you more...

        Bye...
         
        Regards
        Udayakumar Sarangapani
        PHP Developer
        CompIndia Infotech Pvt. Ltd.
        Chennai.


        ----- Original Message ----
        From: Pritesh Loke <priteshloke@...>
        To: "bang-phpug@yahoogroups.com" <bang-phpug@yahoogroups.com>; "php4india@yahoogroups.com" <php4india@yahoogroups.com>; "php_and_mysql@yahoogroups.com" <php_and_mysql@yahoogroups.com>
        Sent: Thursday, May 31, 2007 6:03:19 PM
        Subject: [php4india] {Query} problem in mysql

        Hello To all
                           hay pls checked this attach image i have big problem in mysql
        i have to select id which sum(amount) is greater then 3 so i write query like
        select id from sss having sum(amount)>3

        but not working any pls body tell me the solution as soon as possible.

        Thank you.


        PML


        Don't be flakey. Get Yahoo! Mail for Mobile and
        always stay connected to friends.




        Sucker-punch spam with award-winning protection.
        Try the free Yahoo! Mail Beta.
      • gopi nadh
        hi, plz use this query this might be helpful: select id from group by user_id having sum(amount) 3 ... From: Pritesh Loke
        Message 3 of 11 , Jun 4, 2007
          hi,
          plz use this query
          this might be helpful:
          select id from <table_name> group by user_id having sum(amount)  > 3

          ----- Original Message ----
          From: Pritesh Loke <priteshloke@...>
          To: "bang-phpug@yahoogroups.com" <bang-phpug@yahoogroups.com>; "php4india@yahoogroups.com" <php4india@yahoogroups.com>; "php_and_mysql@yahoogroups.com" <php_and_mysql@yahoogroups.com>
          Sent: Thursday, May 31, 2007 6:03:19 PM
          Subject: [php4india] {Query} problem in mysql

          Hello To all
                             hay pls checked this attach image i have big problem in mysql
          i have to select id which sum(amount) is greater then 3 so i write query like
          select id from sss having sum(amount)>3

          but not working any pls body tell me the solution as soon as possible.

          Thank you.


          PML


          Don't be flakey. Get Yahoo! Mail for Mobile and
          always stay connected to friends.




          Looking for earth-friendly autos?
          Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
        • Pritesh Loke
          Hello This is my table trans_id | user_id | amount| type 1 | 943 | 1 | test 2 | 943 | 1 | test 3 | 943 | 1
          Message 4 of 11 , Jun 5, 2007
            Hello

            This is my table
            trans_id | user_id | amount| type
                 1      |    943   |   1       | test
                 2      |    943   |   1       | test
                 3      |    943   |   1       | pending
                 4      |    1       |   2      | test

            This is my query

            select user_id,sum(amount) from table where type='test' group by user_id having sum(amount)>1

            This will give me

            943  |  2
            1     |   2
            but i want to know that what is the trans id for this added results ?

            Thank you.


            Udaya kumar <udayakumaar@...> wrote:
            Hi Pritesh Lokesh,

            First you have to listen onething while using SUM function in SQLs. That is, If you want to use SUM or AVERAGE function in sql then you have to use GROUP BY column_name in that sql. But in your query, you have missed that one.

            If you want to take all users those who have more than amount 3 then you can use the following...

            SELECT id FROM <table_name> WHERE SUM(amount) > 3 GROUP BY user_id

            Suppose if you want to identify each having more than amount 3 then you can follow this...

            SELECT id FROM <table_name> WHERE amount > 3

            If you have any doubt, mail to me... i will clarify you more...

            Bye...
             
            Regards
            Udayakumar Sarangapani
            PHP Developer
            CompIndia Infotech Pvt. Ltd.
            Chennai.


            ----- Original Message ----
            From: Pritesh Loke <priteshloke@ yahoo.com>
            To: "bang-phpug@ yahoogroups. com" <bang-phpug@yahoogro ups.com>; "php4india@yahoogro ups.com" <php4india@yahoogrou ps.com>; "php_and_mysql@ yahoogroups. com" <php_and_mysql@ yahoogroups. com>
            Sent: Thursday, May 31, 2007 6:03:19 PM
            Subject: [php4india] {Query} problem in mysql

            Hello To all
                               hay pls checked this attach image i have big problem in mysql
            i have to select id which sum(amount) is greater then 3 so i write query like
            select id from sss having sum(amount)>3

            but not working any pls body tell me the solution as soon as possible.

            Thank you.


            PML

            Don't be flakey. Get Yahoo! Mail for Mobile and
            always stay connected to friends.



            Sucker-punch spam with award-winning protection.
            Try the free Yahoo! Mail Beta.



            PML


            You snooze, you lose. Get messages ASAP with AutoCheck
            in the all-new Yahoo! Mail Beta.

          • Udaya kumar
            Hi, trans_id is the auto_increment field in the table. It is used for deleting particular transaction in that table. I could not reach your problem... Can you
            Message 5 of 11 , Jun 5, 2007
              Hi,

              trans_id is the auto_increment field in the table. It is used for deleting particular transaction in that table.

              I could not reach your problem... Can you tell me what your problem in your query having...?

              Otherwise can you tell the business logic for taking the way of data from the following table ?

              Have you solved your query problem...?
               
              Regards
              Udayakumar Sarangapani
              PHP Developer
              CompIndia Infotech Pvt. Ltd.
              Chennai.


              ----- Original Message ----
              From: Pritesh Loke <priteshloke@...>
              To: php4india@yahoogroups.com
              Sent: Tuesday, June 5, 2007 1:10:19 PM
              Subject: Re: [php4india] {Query} problem in mysql

              Hello

              This is my table
              trans_id | user_id | amount| type
                   1      |    943   |   1       | test
                   2      |    943   |   1       | test
                   3      |    943   |   1       | pending
                   4      |    1       |   2      | test

              This is my query

              select user_id,sum( amount) from table where type='test' group by user_id having sum(amount)>1

              This will give me

              943  |  2
              1     |   2
              but i want to know that what is the trans id for this added results ?

              Thank you.


              Udaya kumar <udayakumaar@ yahoo.com> wrote:

              Hi Pritesh Lokesh,

              First you have to listen onething while using SUM function in SQLs. That is, If you want to use SUM or AVERAGE function in sql then you have to use GROUP BY column_name in that sql. But in your query, you have missed that one.

              If you want to take all users those who have more than amount 3 then you can use the following...

              SELECT id FROM <table_name> WHERE SUM(amount) > 3 GROUP BY user_id

              Suppose if you want to identify each having more than amount 3 then you can follow this...

              SELECT id FROM <table_name> WHERE amount > 3

              If you have any doubt, mail to me... i will clarify you more...

              Bye...
               
              Regards
              Udayakumar Sarangapani
              PHP Developer
              CompIndia Infotech Pvt. Ltd.
              Chennai.


              ----- Original Message ----
              From: Pritesh Loke <priteshloke@ yahoo.com>
              To: "bang-phpug@ yahoogroups. com" <bang-phpug@yahoogro ups.com>; "php4india@yahoogro ups.com" <php4india@yahoogrou ps.com>; "php_and_mysql@ yahoogroups. com" <php_and_mysql@ yahoogroups. com>
              Sent: Thursday, May 31, 2007 6:03:19 PM
              Subject: [php4india] {Query} problem in mysql

              Hello To all
                                 hay pls checked this attach image i have big problem in mysql
              i have to select id which sum(amount) is greater then 3 so i write query like
              select id from sss having sum(amount)>3

              but not working any pls body tell me the solution as soon as possible.

              Thank you.


              PML

              Don't be flakey. Get Yahoo! Mail for Mobile and
              always stay connected to friends.



              Sucker-punch spam with award-winning protection.
              Try the free Yahoo! Mail Beta.



              PML


              You snooze, you lose. Get messages ASAP with AutoCheck
              in the all-new Yahoo! Mail Beta.




              Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.
            • Mohamed Mahir Ahamed Ibrahim
              Hi try this select user_id,sum(amount),trans_id from table where type= test group by user_id,trans_id having sum(amount) 1 Mahir
              Message 6 of 11 , Jun 5, 2007
                Hi

                try this

                select user_id,sum(amount),trans_id from table where type='test' group by user_id,trans_id having sum(amount)>1

                Mahir

                On 6/5/07, Pritesh Loke <priteshloke@...> wrote:

                Hello

                This is my table
                trans_id | user_id | amount| type
                     1      |    943   |   1       | test
                     2      |    943   |   1       | test
                     3      |    943   |   1       | pending
                     4      |    1       |   2      | test

                This is my query

                select user_id,sum(amount) from table where type='test' group by user_id having sum(amount)>1

                This will give me

                943  |  2
                1     |   2
                but i want to know that what is the trans id for this added results ?

                Thank you.




                Udaya kumar <udayakumaar@yahoo.com > wrote:
                Hi Pritesh Lokesh,

                First you have to listen onething while using SUM function in SQLs. That is, If you want to use SUM or AVERAGE function in sql then you have to use GROUP BY column_name in that sql. But in your query, you have missed that one.

                If you want to take all users those who have more than amount 3 then you can use the following...

                SELECT id FROM <table_name> WHERE SUM(amount) > 3 GROUP BY user_id

                Suppose if you want to identify each having more than amount 3 then you can follow this...

                SELECT id FROM <table_name> WHERE amount > 3

                If you have any doubt, mail to me... i will clarify you more...

                Bye...
                 
                Regards
                Udayakumar Sarangapani
                PHP Developer
                CompIndia Infotech Pvt. Ltd.
                Chennai.


                ----- Original Message ----
                From: Pritesh Loke <priteshloke@ yahoo.com>
                To: "bang-phpug@yahoogroups.com" <bang-phpug@yahoogro ups.com>; "php4india@yahoogroups.com" <php4india@yahoogrou ps.com>; "php_and_mysql@yahoogroups.com" <php_and_mysql@yahoogroups.com>
                Sent: Thursday, May 31, 2007 6:03:19 PM
                Subject: [php4india] {Query} problem in mysql

                Hello To all
                                   hay pls checked this attach image i have big problem in mysql
                i have to select id which sum(amount) is greater then 3 so i write query like
                select id from sss having sum(amount)>3

                but not working any pls body tell me the solution as soon as possible.

                Thank you.


                PML

                Don't be flakey. Get Yahoo! Mail for Mobile and
                always stay connected to friends.



                Sucker-punch spam with award-winning protection.
                Try the free Yahoo! Mail Beta.



                PML


                You snooze, you lose. Get messages ASAP with AutoCheck
                in the all-new Yahoo! Mail Beta.


              • Barua Saikat
                Hi, Try this select group_concat(trans_id),user_id,sum( amount) from table where type= test group by user_id having sum(amount) 1 Hope this will solve ur
                Message 7 of 11 , Jun 5, 2007
                  Hi,

                  Try this

                  select group_concat(trans_id),user_id,sum( amount)
                  from table where type='test' group by user_id having
                  sum(amount)>1

                  Hope this will solve ur problem
                  Saikat


                  --- Pritesh Loke <priteshloke@...> wrote:

                  > Hello
                  >
                  > This is my table
                  > trans_id | user_id | amount| type
                  > 1 | 943 | 1 | test
                  > 2 | 943 | 1 | test
                  > 3 | 943 | 1 | pending
                  > 4 | 1 | 2 | test
                  >
                  > This is my query
                  >
                  > select user_id,sum(amount) from table where
                  > type='test' group by user_id having sum(amount)>1
                  >
                  > This will give me
                  >
                  > 943 | 2
                  > 1 | 2
                  > but i want to know that what is the trans id for
                  > this added results ?
                  >
                  > Thank you.
                  >
                  >
                  > Udaya kumar <udayakumaar@...> wrote:
                  >
                  > Hi Pritesh Lokesh,
                  >
                  > First you have to listen onething while using SUM
                  > function in SQLs. That is, If you want to use SUM or
                  > AVERAGE function in sql then you have to use GROUP
                  > BY column_name in that sql. But in your query, you
                  > have missed that one.
                  >
                  > If you want to take all users those who have more
                  > than amount 3 then you can use the following...
                  >
                  > SELECT id FROM <table_name> WHERE SUM(amount) > 3
                  > GROUP BY user_id
                  >
                  > Suppose if you want to identify each having more
                  > than amount 3 then you can follow this...
                  >
                  > SELECT id FROM <table_name> WHERE amount > 3
                  >
                  > If you have any doubt, mail to me... i will clarify
                  > you more...
                  >
                  > Bye...
                  >
                  > Regards
                  > Udayakumar Sarangapani
                  > PHP Developer
                  > CompIndia Infotech Pvt. Ltd.
                  > Chennai.
                  >
                  >
                  >
                  > ----- Original Message ----
                  > From: Pritesh Loke <priteshloke@...>
                  > To: "bang-phpug@yahoogroups.com"
                  > <bang-phpug@yahoogroups.com>;
                  > "php4india@yahoogroups.com"
                  > <php4india@yahoogroups.com>;
                  > "php_and_mysql@yahoogroups.com"
                  > <php_and_mysql@yahoogroups.com>
                  > Sent: Thursday, May 31, 2007 6:03:19 PM
                  > Subject: [php4india] {Query} problem in mysql
                  >
                  > Hello To all
                  > hay pls checked this attach image
                  > i have big problem in mysql
                  > i have to select id which sum(amount) is greater
                  > then 3 so i write query like
                  > select id from sss having sum(amount)>3
                  >
                  > but not working any pls body tell me the solution as
                  > soon as possible.
                  >
                  > Thank you.
                  >
                  >
                  > PML
                  >
                  >
                  > ---------------------------------
                  > Don't be flakey. Get Yahoo! Mail for Mobile and
                  > always stay connected to friends.
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                  > ---------------------------------
                  > Sucker-punch spam with award-winning protection.
                  > Try the free Yahoo! Mail Beta.
                  >
                  >
                  >
                  >
                  > PML
                  >
                  > ---------------------------------
                  > You snooze, you lose. Get messages ASAP with
                  > AutoCheck
                  > in the all-new Yahoo! Mail Beta.




                  ____________________________________________________________________________________
                  Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
                  http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
                • Pritesh Loke
                  no they show me last select trans_id Mohamed Mahir Ahamed Ibrahim wrote: Hi try this select
                  Message 8 of 11 , Jun 6, 2007
                    no they show me last select trans_id

                    Mohamed Mahir Ahamed Ibrahim <mahir78@...> wrote:
                    Hi

                    try this

                    select user_id,sum( amount),trans_id from table where type='test' group by user_id,trans_id having sum(amount)>1

                    Mahir

                    On 6/5/07, Pritesh Loke <priteshloke@ yahoo.com> wrote:
                    Hello

                    This is my table
                    trans_id | user_id | amount| type
                         1      |    943   |   1       | test
                         2      |    943   |   1       | test
                         3      |    943   |   1       | pending
                         4      |    1       |   2      | test

                    This is my query

                    select user_id,sum( amount) from table where type='test' group by user_id having sum(amount)>1

                    This will give me

                    943  |  2
                    1     |   2
                    but i want to know that what is the trans id for this added results ?

                    Thank you.



                    Udaya kumar <udayakumaar@yahoo.com > wrote:
                    Hi Pritesh Lokesh,

                    First you have to listen onething while using SUM function in SQLs. That is, If you want to use SUM or AVERAGE function in sql then you have to use GROUP BY column_name in that sql. But in your query, you have missed that one.

                    If you want to take all users those who have more than amount 3 then you can use the following...

                    SELECT id FROM <table_name> WHERE SUM(amount) > 3 GROUP BY user_id

                    Suppose if you want to identify each having more than amount 3 then you can follow this...

                    SELECT id FROM <table_name> WHERE amount > 3

                    If you have any doubt, mail to me... i will clarify you more...

                    Bye...
                     
                    Regards
                    Udayakumar Sarangapani
                    PHP Developer
                    CompIndia Infotech Pvt. Ltd.
                    Chennai.


                    ----- Original Message ----
                    From: Pritesh Loke <priteshloke@ yahoo.com>
                    To: "bang-phpug@yahoogro ups.com" <bang-phpug@yahoogro ups.com>; "php4india@yahoogroups.com" <php4india@yahoogrou ps.com>; "php_and_mysql@ yahoogroups. com" <php_and_mysql@ yahoogroups. com>
                    Sent: Thursday, May 31, 2007 6:03:19 PM
                    Subject: [php4india] {Query} problem in mysql

                    Hello To all
                                       hay pls checked this attach image i have big problem in mysql
                    i have to select id which sum(amount) is greater then 3 so i write query like
                    select id from sss having sum(amount)>3

                    but not working any pls body tell me the solution as soon as possible.

                    Thank you.


                    PML

                    Don't be flakey. Get Yahoo! Mail for Mobile and
                    always stay connected to friends.



                    Sucker-punch spam with award-winning protection.
                    Try the free Yahoo! Mail Beta.



                    PML

                    You snooze, you lose. Get messages ASAP with AutoCheck
                    in the all-new Yahoo! Mail Beta.




                    PML


                    Pinpoint customers who are looking for what you sell.

                  • Pritesh Loke
                    Hello No still i not solved the problem.Yes trans_id is my parent key and i have group user_id from and pay the commission using that user_id but after i pay i
                    Message 9 of 11 , Jun 6, 2007
                      Hello
                            No still i not solved the problem.Yes trans_id is my parent key and i have group user_id from and pay the commission using that user_id but after i pay i want to update table using trans id that i cannot do.In my query there one more checked for payment_processor which can be paypal or alertpay.

                      Thank you

                      Udaya kumar <udayakumaar@...> wrote:
                      Hi,

                      trans_id is the auto_increment field in the table. It is used for deleting particular transaction in that table.

                      I could not reach your problem... Can you tell me what your problem in your query having...?

                      Otherwise can you tell the business logic for taking the way of data from the following table ?

                      Have you solved your query problem...?
                       
                      Regards
                      Udayakumar Sarangapani
                      PHP Developer
                      CompIndia Infotech Pvt. Ltd.
                      Chennai.


                      ----- Original Message ----
                      From: Pritesh Loke <priteshloke@ yahoo.com>
                      To: php4india@yahoogrou ps.com
                      Sent: Tuesday, June 5, 2007 1:10:19 PM
                      Subject: Re: [php4india] {Query} problem in mysql

                      Hello

                      This is my table
                      trans_id | user_id | amount| type
                           1      |    943   |   1       | test
                           2      |    943   |   1       | test
                           3      |    943   |   1       | pending
                           4      |    1       |   2      | test

                      This is my query

                      select user_id,sum( amount) from table where type='test' group by user_id having sum(amount)>1

                      This will give me

                      943  |  2
                      1     |   2
                      but i want to know that what is the trans id for this added results ?

                      Thank you.


                      Udaya kumar <udayakumaar@ yahoo.com> wrote:
                      Hi Pritesh Lokesh,

                      First you have to listen onething while using SUM function in SQLs. That is, If you want to use SUM or AVERAGE function in sql then you have to use GROUP BY column_name in that sql. But in your query, you have missed that one.

                      If you want to take all users those who have more than amount 3 then you can use the following...

                      SELECT id FROM <table_name> WHERE SUM(amount) > 3 GROUP BY user_id

                      Suppose if you want to identify each having more than amount 3 then you can follow this...

                      SELECT id FROM <table_name> WHERE amount > 3

                      If you have any doubt, mail to me... i will clarify you more...

                      Bye...
                       
                      Regards
                      Udayakumar Sarangapani
                      PHP Developer
                      CompIndia Infotech Pvt. Ltd.
                      Chennai.


                      ----- Original Message ----
                      From: Pritesh Loke <priteshloke@ yahoo.com>
                      To: "bang-phpug@ yahoogroups. com" <bang-phpug@yahoogro ups.com>; "php4india@yahoogro ups.com" <php4india@yahoogrou ps.com>; "php_and_mysql@ yahoogroups. com" <php_and_mysql@ yahoogroups. com>
                      Sent: Thursday, May 31, 2007 6:03:19 PM
                      Subject: [php4india] {Query} problem in mysql

                      Hello To all
                                         hay pls checked this attach image i have big problem in mysql
                      i have to select id which sum(amount) is greater then 3 so i write query like
                      select id from sss having sum(amount)>3

                      but not working any pls body tell me the solution as soon as possible.

                      Thank you.


                      PML

                      Don't be flakey. Get Yahoo! Mail for Mobile and
                      always stay connected to friends.



                      Sucker-punch spam with award-winning protection.
                      Try the free Yahoo! Mail Beta.



                      PML

                      You snooze, you lose. Get messages ASAP with AutoCheck
                      in the all-new Yahoo! Mail Beta.



                      Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.



                      PML


                      You snooze, you lose. Get messages ASAP with AutoCheck
                      in the all-new Yahoo! Mail Beta.

                    • gopi nadh
                      ... From: Pritesh Loke To: php4india@yahoogroups.com Sent: Wednesday, June 6, 2007 5:04:03 PM Subject: Re: [php4india] {Query} problem
                      Message 10 of 11 , Jun 8, 2007


                        ----- Original Message ----
                        From: Pritesh Loke <priteshloke@...>
                        To: php4india@yahoogroups.com
                        Sent: Wednesday, June 6, 2007 5:04:03 PM
                        Subject: Re: [php4india] {Query} problem in mysql

                        no they show me last select trans_id

                        Mohamed Mahir Ahamed Ibrahim <mahir78@gmail. com> wrote:

                        Hi

                        try this

                        select user_id,sum( amount),trans_id from table where type='test' group by user_id,trans_id having sum(amount)>1

                        Mahir

                        On 6/5/07, Pritesh Loke <priteshloke@ yahoo.com> wrote:
                        Hello

                        This is my table
                        trans_id | user_id | amount| type
                             1      |    943   |   1       | test
                             2      |    943   |   1       | test
                             3      |    943   |   1       | pending
                             4      |    1       |   2      | test

                        This is my query

                        select user_id,sum( amount) from table where type='test' group by user_id having sum(amount)>1

                        This will give me

                        943  |  2
                        1     |   2
                        but i want to know that what is the trans id for this added results ?

                        Thank you.



                        Udaya kumar <udayakumaar@yahoo.com > wrote:
                        Hi Pritesh Lokesh,

                        First you have to listen onething while using SUM function in SQLs. That is, If you want to use SUM or AVERAGE function in sql then you have to use GROUP BY column_name in that sql. But in your query, you have missed that one.

                        If you want to take all users those who have more than amount 3 then you can use the following...

                        SELECT id FROM <table_name> WHERE SUM(amount) > 3 GROUP BY user_id

                        Suppose if you want to identify each having more than amount 3 then you can follow this...

                        SELECT id FROM <table_name> WHERE amount > 3

                        If you have any doubt, mail to me... i will clarify you more...

                        Bye...
                         
                        Regards
                        Udayakumar Sarangapani
                        PHP Developer
                        CompIndia Infotech Pvt. Ltd.
                        Chennai.


                        ----- Original Message ----
                        From: Pritesh Loke <priteshloke@ yahoo.com>
                        To: "bang-phpug@yahoogro ups.com" <bang-phpug@yahoogro ups.com>; "php4india@yahoogroups.com" <php4india@yahoogrou ps.com>; "php_and_mysql@ yahoogroups. com" <php_and_mysql@ yahoogroups. com>
                        Sent: Thursday, May 31, 2007 6:03:19 PM
                        Subject: [php4india] {Query} problem in mysql

                        Hello To all
                                           hay pls checked this attach image i have big problem in mysql
                        i have to select id which sum(amount) is greater then 3 so i write query like
                        select id from sss having sum(amount)>3

                        but not working any pls body tell me the solution as soon as possible.

                        Thank you.


                        PML

                        Don't be flakey. Get Yahoo! Mail for Mobile and
                        always stay connected to friends.



                        Sucker-punch spam with award-winning protection.
                        Try the free Yahoo! Mail Beta.



                        PML

                        You snooze, you lose. Get messages ASAP with AutoCheck
                        in the all-new Yahoo! Mail Beta.




                        PML


                        Pinpoint customers who are looking for what you sell.




                        Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
                      Your message has been successfully submitted and would be delivered to recipients shortly.