I have a table that has the following fields: date, time, node, result describing some numerical results for different nodes And do the time throughout every day. The specific list will look something like this:
Date | Time | Node | Results ---------------------------------- 2011-03-01 | 10:02 pm A. 10 2011-03-01 | 11:02 | A. 20 2011-03-02 | 03:13 | A. 23 2011-03-02 | 12:15 | A. 18 2011-03-02 | 13:15 | A. 8 2011-03-01 | 13:12 | B 2 2011-03-01 | 14:26 | B 1 2011-03-02 | 08:00 B 6 2011-03-02 | 07:22 | B 3 2011-03-02 | 21:19 | B 4 I want to create a query that will get the last result from each day for each node, like I get something like this:
< Code> Date | Time | Node | Latest | ----------------------------------- 2011-03-01 | 11:02 | A. 20 2011-03-01 | 14:26 | B 1 2011-03-02 | 13:15 | A. 8 2011-03-02 | 21:19 | B 4 I thought of grouping a with date, node , but then there was a glitch to remove the last value (I used the group_concat (result Used the time) and used the SUBSTRING () to get the last code. Bah, I know). Is mysql a simple way to do this?
I am sure I saw a similar request using the INNER JOIN It's doing a great deal without doing it, but I just can not find it (and it might be SQL Server) but still do the following. No selection * Join nodes en inner (select MAX (time) AS time, date, date by node group, node) nm at nm. Time = n. Time and NMDet = n. Date and nm Node = N.Node
Comments
Post a Comment