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

Need help (sort order for group by in mysql)

Expand Messages
  • mahesh_lvj
    Hi,i am using mysql group by(ex: select * from table group by name) to fetch data from db,it working but returning first value of the group,but i need last or
    Message 1 of 3 , Feb 13, 2009
    • 0 Attachment
      Hi,i am using mysql group by(ex: select * from table group by name) to
      fetch data from db,it working but returning first value of the
      group,but i need last or most recent value(like recent photo).

      Can somebody help me.
    • Koushik G raj
      mahesh, use order by id desc after group by. ... Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
      Message 2 of 3 , Feb 20, 2009
      • 0 Attachment
        mahesh,

        use

        order by id desc

        after group by.

        --- On Fri, 13/2/09, mahesh_lvj <mahesh_lvj@...> wrote:

        > From: mahesh_lvj <mahesh_lvj@...>
        > Subject: [bang-phpug] Need help (sort order for group by in mysql)
        > To: bang-phpug@yahoogroups.com
        > Date: Friday, 13 February, 2009, 4:45 PM
        > Hi,i am using mysql group by(ex: select * from table group
        > by name) to
        > fetch data from db,it working but returning first value of
        > the
        > group,but i need last or most recent value(like recent
        > photo).
        >
        > Can somebody help me.


        Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
      • Gurramq Anurag
        Please use last_insert id function in my-sql to access recent id s [Non-text portions of this message have been removed]
        Message 3 of 3 , Feb 24, 2009
        • 0 Attachment
          Please use last_insert id function in my-sql to access recent id's

          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.