MySQL Forums
Forum List  »  German

DISCTINCT / GROUP BY oder doch anders?
Posted by: Markus Halle
Date: October 05, 2010 06:45PM

Hello MySQL Community, I've got a problem.
I got a database with some user data. Example:


id name Time
1 Mike 45
2 Jim 47
3 Jon 1
4 Mike 43
5 Mike 43
6 Joe 17
7 Mike 43

Obviously "Mike" is the problem having similar time figures. For a few hours now I am trying to create a query which exactly gives me the following result:

Mike 45
Mike 43

I've experimented with DISTINCT, GROUP BY but no success so far.

SELECT name,time FROM exampletable WHERE name = 'Mike' GROUP BY time -> no success

Glad for any help from you guys.Basically its about more than a million datasets.
Just for better understanding I exported my database structure with some inserts from them (all my data) for download here:

http://www.metworld.de/pilots_data.zip

What I want to get as a result from the database is a list of my entries, where timeconnected is the same (maybe via GROUP BY timeconnected) so that I only get one entry for every disctinct timeconnected value.

So my try was:

SELECT DISTINCT timeconnected FROM pilots_data WHERE vid = 237808 -> no success
SELECT name, timeconnected FROM pilots_data WHERE vid = 237808 GROUP BY timeconnected -> no success

Maybe I make a big mistake and have tomatoes on my eyes. Somethings wrong with my database structure?



Edited 2 time(s). Last edit at 10/05/2010 07:01PM by Markus Halle.

Options: ReplyQuote


Subject
Views
Written By
Posted
DISCTINCT / GROUP BY oder doch anders?
2775
October 05, 2010 06:45PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.