473,765 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select problem


Hi all,

I have a table with the following data:

+--------+-----------+----------------------------------+
| lpcval | smiles_id | crhash |
+--------+-----------+----------------------------------+
| 0.81 | 996 | 0597b6f84e0feaf 9596869284e6e06 60 |
| 0.86 | 996 | 53a88ef9f72a77e eb47da15969e6fb c0 |
| 0.71 | 996 | 251f58e8485335b 094f06352e65bb6 a8 |
| 0.8 | 996 | dd59144f1df0c54 f299a2f9a558704 2a |
| 0.86 | 997 | bad8fe7edb74c3e d4495a4825750d3 4d |
| 0.88 | 997 | aefd10198ff8db9 47c78e0aa0e1e34 9d |
| 0.76 | 997 | ade6c8f5d491109 1eed515ad75db07 0a |
| 0.73 | 998 | e2b0623ad9b77b9 5d76c00fb76614c 0e |
| 0.7 | 998 | 2672157a6ec823d 2170cfe4b381230 79 |
| 0.78 | 998 | 92746af8be0431c 2fd0dda646a1827 cf |
| 0.77 | 998 | ac087a6b796057e 29941a2d1358c3e b1 |
| 0.79 | 998 | a631bb5f3d3ecac d9c206f6d9f0c8b ee |
+--------+-----------+----------------------------------+

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 | 53a88ef9f72a77e eb47da15969e6fb c0 |
| 0.88 | 997 | aefd10198ff8db9 47c78e0aa0e1e34 9d |
| 0.79 | 998 | a631bb5f3d3ecac d9c206f6d9f0c8b ee |
+--------+-----------+----------------------------------+

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 ? mysweetestfrien d everyoneiknow goesawayintheen d
youcouldhaveita ll myempireofdirt iwillletyoudown iwillmakeyouhur t
ificouldstartag ain amillionmilesaw ay iwouldkeepmysel f 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 1201

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

Similar topics

1
2452
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
2895
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 try create a param using this search critieria it can never seem to locate what I am looking for. For example, check out the following XML file: ------------------------- <data> <aBlock id="1"> <tmpdata> <stringType>Hi</stringType>
3
1586
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 with and without the <FORM></FORM>. In Mac Netscape 6 the onChange does not activate if there is no <FORM></FORM>. When I put it in a form as indicated below the value of train.options.value is undefined. What am I doing wrong?
3
6471
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 COULD be wrong... :) I've tried the access group...twice...and all I get is "Access doesn't like ".", which I know, or that my query names are too long, as there's a limit to the length of the SQL statement(s). But this works when I don't try to...
1
4178
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 couple of tables in my database using INNER JOINS and the WHERE clause to specify the required constraints. However, I also want to read two fields from a *single* record from a table called 'Locations' and then apply one of these field's values...
2
9926
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 (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's id in an arraylist. The idea was to do the sort and then go back and re-select the rows with that...
2
3661
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 /////////////////////////////////////////////////////////////////////////////////////// <form action="whatever.php" method="post"> <select name="zip_code" onchange="makeRequest('getCity.php?state='+this.form.zip_code.options.value)" multiple="multiple" size="20">
3
12557
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 = window.document.forms.srcList;
13
5799
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 CatalogImage where imgID also needs to be placed. Below is my code behind to carry the catID using the Select @@Identity and insert imgID to the bridge table. No data is being entered into the bridge table.
2
4365
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 of the xml: <Stats> <Structure> <Column DisplayName="GP" FieldName="GamesPlayed" Priority="1" /> <Column DisplayName="G" FieldName="Goals" Priority="2" />
0
9566
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9946
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7371
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6646
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5272
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5413
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2800
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.