473,320 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Select problem


Hi all,

I have a table with the following data:

+--------+-----------+----------------------------------+
| lpcval | smiles_id | crhash |
+--------+-----------+----------------------------------+
| 0.81 | 996 | 0597b6f84e0feaf9596869284e6e0660 |
| 0.86 | 996 | 53a88ef9f72a77eeb47da15969e6fbc0 |
| 0.71 | 996 | 251f58e8485335b094f06352e65bb6a8 |
| 0.8 | 996 | dd59144f1df0c54f299a2f9a5587042a |
| 0.86 | 997 | bad8fe7edb74c3ed4495a4825750d34d |
| 0.88 | 997 | aefd10198ff8db947c78e0aa0e1e349d |
| 0.76 | 997 | ade6c8f5d4911091eed515ad75db070a |
| 0.73 | 998 | e2b0623ad9b77b95d76c00fb76614c0e |
| 0.7 | 998 | 2672157a6ec823d2170cfe4b38123079 |
| 0.78 | 998 | 92746af8be0431c2fd0dda646a1827cf |
| 0.77 | 998 | ac087a6b796057e29941a2d1358c3eb1 |
| 0.79 | 998 | a631bb5f3d3ecacd9c206f6d9f0c8bee |
+--------+-----------+----------------------------------+

What I want to be able to do is for each value of smiles_id to be able
to select the row with the largest value of lpcval. This should leave
me with a table like

+--------+-----------+----------------------------------+
| lpcval | smiles_id | crhash |
+--------+-----------+----------------------------------+
| 0.86 | 996 | 53a88ef9f72a77eeb47da15969e6fbc0 |
| 0.88 | 997 | aefd10198ff8db947c78e0aa0e1e349d |
| 0.79 | 998 | a631bb5f3d3ecacd9c206f6d9f0c8bee |
+--------+-----------+----------------------------------+

My closest attempt is

select max(lpcval) as lpcval, smiles_id, crhash from results group by
smiles_id;

but that gives me the "wrong" crhash. I guess my understanding of max
is less than it should be :) Any pointers on were to look next would
be greatly appreciated.
Dermot
--
whathaveibecome? mysweetestfriend everyoneiknow goesawayintheend
youcouldhaveitall myempireofdirt iwillletyoudown iwillmakeyouhurt
ificouldstartagain amillionmilesaway iwouldkeepmyself iwouldfindaway

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1191

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: D. Shifflett | last post by:
Hi all, I am having trouble with a program that ran fine on Python 2.0 (#0, Mar 1 2001, 01:47:55) on linux2 but will not work on Python 2.3.2 (#1, Oct 8 2003, 17:33:47) on linux2
2
by: RanDeep | last post by:
I have two nodes that both exist underneath the root node. They are linked, however, in the sense that one of the nodes contains a copy of an id that is used to refer to the other. However, when I...
3
by: Dennis M. Marks | last post by:
I have a problem with the following code. It generates a <FORM><SELECT><OPTION> list. There is no problem in the generating. The problem is in the execution as follows. It works fine in Mac IE...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
2
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
2
by: areef.islam | last post by:
Hi, I am kinda new to javascript and I am having this problem with selecting multiple options from a select tag. Hope someone can help me out here. here is my code...
3
by: imrantbd | last post by:
This is my first problem.Please help me. I have the following code: <head> <script language="JavaScript"> function addSrcToDestList() { destList1 = window.document.forms.destList; srcList...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
2
by: djnokturnal | last post by:
Hey guys / gals, First time posting and of course I am sure it is something that has been answered 100 times but for some reason I just cant find the answer :) First off here is the structure...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.