Professional Web Applications Themes

Make GROUP BY select entries i want - MySQL

Hi Is there a way to tell group by to group by lets say user_id and to choice the entry where login_time is most recent? Thank you Ralph...

  1. #1

    Default Make GROUP BY select entries i want

    Hi

    Is there a way to tell group by to group by lets say user_id and to
    choice the entry where login_time is most recent?

    Thank you
    Ralph
    Ralph Guest

  2. #2

    Default Make GROUP BY select entries i want

    Hi

    Is there a way to tell group by to group by lets say user_id and to
    choice the entry where login_time is most recent?

    Thank you
    Ralph
    Ralph Guest

  3. #3

    Default Make GROUP BY select entries i want

    Hi

    Is there a way to tell group by to group by lets say user_id and to
    choice the entry where login_time is most recent?

    Thank you
    Ralph
    Ralph Guest

  4. #4

    Default Make GROUP BY select entries i want

    Hi

    Is there a way to tell group by to group by lets say user_id and to
    choice the entry where login_time is most recent?

    Thank you
    Ralph
    Ralph Guest

  5. #5

    Default Re: Make GROUP BY select entries i want

    Ralph wrote: 

    Maybe you need to run GROUP BY on your newsgroup posts, too. ;-)

    No, there's no way to tell GROUP BY to resolve the ambiguity for you.

    Here's a solution for the question you asked:

    SELECT t1.*
    FROM tablex AS t1 LEFT JOIN tablex AS t2
    ON t1.user_id = t2.user_id AND t1.login_time < t2.login_time
    WHERE t2.login_time IS NULL

    Regards,
    Bill K.

    Bill Guest

Similar Threads

  1. Replies: 5
    Last Post: October 20th, 09:23 AM
  2. distinct group of entries
    By paross1 in forum Coldfusion Database Access
    Replies: 8
    Last Post: August 17th, 10:35 PM
  3. How to group Typo entries in a database
    By premgrps@gmail.com in forum MySQL
    Replies: 2
    Last Post: June 30th, 06:58 AM
  4. select last 4 entries
    By johnbennett in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: July 11th, 07:01 PM
  5. SELECT COUNT, but only on the last 100 entries
    By Bob in forum ASP Database
    Replies: 6
    Last Post: August 20th, 11:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139