Using Oracle SQL.   COL1        COL2                COL3    COL4 2017-12-01  2017-12-01 02:00    296.82  161 2017-12-01  2017-12-01 06:00    287.25  158 2017-12-01  2017-12-01 10:00    290.3   157 2017-12-01  2017-12-01 14:00    345.58  157 2017-12-01  2017-12-01 18:00    285.13  156 2017-12-01  2017-12-01 22:00    287.68  158 2017-12-02  2017-12-02 02:00    306.5   164 2017-12-02  2017-12-02 06:00    315.79  166 2017-12-02  2017-12-02 10:00    307.59  164   What I need to do is get the MAX(COL3) from each day but I need the other values out of the row as well....I can group by COL1 but I'm having issues returning the other values COL2 and COL4 from the row as well.   Almost there however this is not working It is saying that the from is in a bad location.....  SELECT *,MAX(VDC) OVER (PARTITION BY DATETHE) from (select  trunc(x.lvl) "DATETHE", energy_metrics_pdu.WATTS_READING "PDU", case energy_metrics_pdu.watts_reading when 0 then NULL else round(energy_metrics_vdc.watts_reading/energy_metrics_pdu.WATTS_READING,2) END "RATIO", energy_metrics_vdc.watts_reading "VDC" from (  SELECT to_date('01-DEC-2017','DD-MON-YYYY') + (level/24)-0  lvl         FROM dual         CONNECT BY LEVEL &lt;= (5*24)-1 ) x          LEFT JOIN energy_metrics_pdu on to_char(x.lvl, 'YYYY-MM-DD HH24') = to_char(energy_metrics_pdu.READING_DATE, 'YYYY-MM-DD HH24')          LEFT join energy_metrics_vdc on to_char(x.lvl, 'YYYY-MM-DD HH24')||':00' = to_char(energy_metrics_vdc.READING_DATE, 'YYYY-MM-DD HH24:MI')         where energy_metrics_pdu.watts_reading IS NOT NULL  order by "DATETHE" ASC          );    Any suggestions...
Table:   UserId, Value, Date.   I want to get the UserId, Value for the max(Date) for each UserId. That is, the Value for each UserId that has the latest date. Is there a way to do this simply in SQL? (Preferably Oracle)  Update: Apologies for any ambiguity: I need to get ALL the UserIds. But for each UserId, only that row where that user has the latest date.
I know the statement:  create table xyz_new as select * from xyz;   Which copies the structure and the data, but what if I just want the structure? How to clip an Openlayers OSM Background to a Vector Boundary? Why is shape with shrinkwrap modifier flat? DMed for the first time yesterday and one of the things I feel I need to sort out, among other comments, improvements, and similar, is how combat itself is actually initiated. The main example I want to use involves  attempting to generate surprise conditions by players. Here the characters have entered a ruined city and generally been noisy about the whole thing - using a spell to make their voice louder and literally ask if there is anyone about. Any enemies around probably know what something is about to kick off but arguably don't know precisely what. After resting the PCs head up a long flight of steps to a temple on the edge of the city. At the top only one crests and finds 3 bandits lounging around, chatting, and doing whatever bandits do in their spare time. After a brief exchange of pleasantries a combat starts:  DM &quot;The bandit spits in your direction 'we're not done looting the temple, so you can clear off', and starts raising his crossbow as his mates emerge from their cover behind the pillars... PC &quot;I cast Firebolt at Bandit Keith&quot; DM &quot;Hang on, I hadn't finished, everyone rolls for initiative...  Which sparked a debate about whether or not the PC could preemptively cast/attack before the combat starts by &quot;instant actioning&quot; (as above) as I was describing the start of the combat. As far as the bandits are concerned a lone half-elf who is pretty heavily armed has popped up in front of them, not even tried to be diplomatic, and ended up saying something rather suggestive about their mothers. The PC then asked about it being &quot;surprise&quot; because the bandits wouldn't necessarily expect an attack, but my view of &quot;surprise&quot; is closer to an ambush where one party is unaware of the other's existence. (This precise example is close to how  works, however this specific PC was always the first of the party to go into rooms (only one with darkvision) and consistently felt they should get free rounds at the start of combat based on declaring attacks before I could &quot;start&quot; the combat.) The second example the party came to more bandits, who were not alert immediately, in an underground room. They used magic to yell something obscene at the bandits and shut off all the torches so the bandits were effectively blinded. At this point they wanted to burst into the room casting spells, swinging maces, and playing some &quot;meaty chords&quot; (the bard's words, not mine). Again they wanted surprise arguing that, despite the fact that the bandits were yelling and cursing in confusion, they couldn't be sure they were actually being attacked as such. In the end a character with darkvision wanted to sneak in to a corner and again wanted surprise based on passing stealth rolls, so they would start the &quot;combat&quot; by firing a crossbow. At that point I think I relented because it was clear that they would do anything to try and win combats in a single round. In a nutshell, my question is: &quot;how liberally can the concept of surprise be applied to combat - is it only when one party is literally unaware of a threat (as I read the rules), or just when they are caught slightly off guard by the exact situation?&quot; NB I already plan to address the attempts at interrupting descriptions with actions next session, because it happened at other times and actually threw me off quite a bit. Deep learning model (LSTM) with temporal and non temporal attributes Proving that kernels of evaluation maps are generated by the $x_i - a_i$ I want to prove that the kernel of the evaluation map $s_a : \mathbb{C}[x_1,\dots,x_n] \rightarrow \mathbb{C}, x_i \mapsto a_i$ where $a = (a_1,\dots, a_n) \in \mathbb{C}^n$ is the ideal generated by $\{x_1 - a_1, \dots, x_n - a_n\}$.    The proof in the book first shows it easily for the case $a = 0$, and says that by substitutions of variables $x_i' = x_i - a_i$, you can show it for the rest of the cases.  I know that $f \in \ker s_a$ iff $f(a) = 0$.  And $\phi : \mathbb{C}[x_1,\dots, x_n] \rightarrow \mathbb{C}[x_1 - a_1, \dots, x_n-a_n], x_i \mapsto x_i - a_i$ is a surjective ring homomorphism.  Please give a hint and not the full answer.  Thanks. When I was younger (11-12 years old, so the early 2000s) I once read a story where a young boy, who may have been either a young prince or a squire of some sort, is recruited by a wizard and taken to a city to train as a mage.  I seem to remember him living in dorms with the other children at this school, until he gets into difficulty with another of the boys in the dorm. He is kicked out of the dorms and ends up living above a blacksmith shop (I think).  I remember it being the first book in a series of books of which there were about 3 out at the time. I think one of the stories was about the boy going to a tower to do something or other.  Does anyone have any idea what this book series is? I haven't been able to find it for years now but it was a story I really loved. How does Linux know where its swap partition is? I've read that you need to put the swap partition on HDD rather than SSD.   My questions are the following:    When and how is the "checking" done by the distribution (or something else) to find its Swap partition?  Does it happen during boot?  It just checks all available disks and searches for a partition with 'swap' flag?  What happens if there are several partitions like that?  Also, how many swap partitions do I need to have if I run, for example, two different distributions on the same disk, let's say Fedora and Ubuntu? Endpoint of a line knowing slope, start and distance In a Cartesian system, I've got the slope, start point and distance of a line segment.  What's the formula to find the endpoint? Use of each and every Is there is any reason to make the permissions on an overridden C++ virtual function different from the base class?  Is there any danger in doing so?  For example:  class base {     public:         virtual int foo(double) = 0; }  class child : public base {     private:         virtual int foo(double); }   The  says that it is a bad idea, but doesn't say why.  I have seen this idiom in some code and I believe that the author was attempting to make the class final, based on an assumption that it is not possible to override a private member function.  However,  shows an example of overriding private functions.  Of course  recommends against doing so.  My concrete questions:   Is there any technical problem with using a different permission for virtual methods in derived classes vs base class? Is there any legitimate reason to do so? One of the new search hints is wrong Why do light disappears the moment we switch off the source (inside the wooden box)? Trying to hide spam/offensive deletions on user profiles announces them Uninstalling/reinstalling QGIS plugin where uninstall is disabled? Plugin Raster->TerrainAnalysis->slope which had initially worked, started showing what another questioner referred to as a "crazy histogram":   Before finding his question and the answer, I endeavored to uninstall and reinstall the plugin.  I found/still find (QGIS 2.0.1, now upgraded to QGIS 2.4, on Ubuntu 14.04), the plugin "uninstall" button grayed out/disabled.  It's working, but I am worried about having a plugin I installed that does not offer an option to be uninstalled.  Failing anything else I would be tempted to use the path information to rename the .so library and see if it disappeared. Execute sudo without Password? What is wrong with "Where should this car be parked?"? Non-linearity and self-coupling of gravity I have heard that non-linearity of  has to do with the fact that gravity self-couples. What does non-linearity have to do with self-coupling? How to typeset the symbol “^” (caret/circumflex/hat) 2/15/18 compiz update broke unity This  forced removal of unity and ubuntu-desktop on my 16.04 Ubuntu system.   The offending package that is missing, but unity needs, seems to be compiz-core-abiversion-20151010. It seems to be a , and I can't find it to download.    As it happens, I mostly use LXDE on this system, but I'd be very unhappy if I used Unity...  Since I do occasionally use the Unity desktop, is there a fix for this?  Edit: related questions are rolling in. Looks like a major quality escape          Edit 2: