Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6603695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:02:58+00:00 2026-05-25T19:02:58+00:00

I have a created a few tables containing multiple records from several users so

  • 0

I have a created a few tables containing multiple records from several users so I can simulate circumstances.

I created the following query:

SELECT 
    a.celid, a.callid, a.active, a.messagetext,
    b.jactive, a.cel_time, c.username, a.muserid 
FROM level2 a, calls b , login c 
WHERE a.callid = b.jid 
  AND a.muserid = c.loginid 
  AND b.jid = 92 
  AND a.win = 0 
  AND b.userid = 12 
ORDER BY 
    cel_time ASC

and got the following as result

545 92  2   hello1  2   2011-09-18 16:32:17.000 phil01  21
546 92  1   hello2  2   2011-09-18 16:42:38.000 phil01  21
547 92  2   hello3  2   2011-09-18 16:59:08.000 danny   16
548 92  1   hello4  2   2011-09-18 20:46:21.000 phil01  21
549 92  1   hello5  2   2011-09-18 20:47:16.000 phil01  21  
550 92  1   hello6  2   2011-09-19 19:32:15.000 phil01  21  
551 92  1   hello7  2   2011-09-19 19:34:14.000 phil01  21  

but I actually want this result to be distinct on muserid and return only return two rows.

I have studied distinct value description but can not seem to get this accomplished.

How would I accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:02:59+00:00Added an answer on May 25, 2026 at 7:02 pm

    Use this SQL:

    SELECT 
        a.celid, a.callid, a.active, a.messagetext,
        b.jactive, a.cel_time, c.username, a.muserid 
    FROM level2 a
    JOIN calls b ON a.callid = b.jid 
    JOIN login c ON a.muserid = c.loginid 
    JOIN 
      (SELECT l2.muserid, MAX(l2.cel_time) as max_time 
       FROM level2 l2 
       GROUP BY l2.muserid) d ON (d.muserid = a.muserid AND a.cel_time = d.max_time)
    WHERE b.jid = 92 
      AND a.win = 0 
      AND b.userid = 12
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a few small flash widgets that stream .mp3 audio from an
We have few components like libraries dlls When initially created I ran the following
I have a few custom tables in my Drupal database that were created manually.
I have created two tables ORDERS and ORDERITEMS with the following constraint: alter table
I have a MySQL 5.0 database with a few tables containing over 50M rows.
i have created a few tables for a schoool project. The tables of interest
I have a few tables that are created by entity framework that house my
I have a user auth table with a few thousand records containing a password
I have created a few DTS packages and saved them on the server. where
I have created a tab control and few forms. Each form opens in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.