Hi I'm on a school project and I can't find a solution to my problem. I have to do a query where I want the entire row of the table with the max value of the &quot;Picco&quot; column for all regions. The code written by me is: SELECT  DELTA.`data`, DELTA.`regione`, DELTA.Differenza AS Picco FROM (SELECT    dr.`data`,   dr.`regione`,   dr.`deceduti`,   dr.`deceduti`-LAG (dr.`deceduti`) OVER (PARTITION BY dr.`regione`) AS Differenza  FROM   `datareg` dr) AS DELTA;  I have this output: | data                  | regione   | Picco | | 2020-03-08 18:00:00   | Abruzzo   | 0     | | 2020-03-09 18:00:00   | Abruzzo   | 0     | | 2020-03-10 18:00:00   | Abruzzo   | 1     | | 2020-03-11 17:00:00   | Abruzzo   | 0     | | 2020-03-12 17:00:00   | Abruzzo   | 1     | ... | 2020-04-03 17:00:00   | Abruzzo   | 13    | | 2020-04-04 17:00:00   | Abruzzo   | 7     | | 2020-04-05 17:00:00   | Abruzzo   | 5     | | 2020-04-06 17:00:00   | Abruzzo   | 11    | | 2020-04-07 17:00:00   | Abruzzo   | 3     | | 2020-04-08 17:00:00   | Abruzzo   | 7     | | 2020-04-09 17:00:00   | Abruzzo   | 15    |-&gt;i want only this row for each region | 2020-04-10 17:00:00   | Abruzzo   | 4     | ..  I don't want all rows for each region, but only one with the max value for the 'Differenza' column. How can I do? Thank you for your time spent for me. Thanks to all, I report the solution for my case: SELECT DELTA.`data`, DELTA.`regione`, MAX(DELTA.Differenza) AS Picco FROM (SELECT   dr.`data`,   dr.`regione`,   dr.`deceduti`,   dr.`deceduti`-LAG (dr.`deceduti`) OVER (PARTITION BY dr.`regione`) AS Differenza FROM   `datareg` dr ORDER BY   dr.`deceduti`-LAG (dr.`deceduti`) OVER (PARTITION BY dr.`regione`) DESC) AS DELTA GROUP BY   DELTA.regione;
My table is:     id home datetime player resource     1 10 04/03/2009 john 399   2 11 04/03/2009 juliet 244   5 12 04/03/2009 borat 555   3 10 03/03/2009 john 300   4 11 03/03/2009 juliet 200   6 12 03/03/2009 borat 500   7 13 24/12/2008 borat 600   8 13 01/01/2009 borat 700     I need to select each distinct home holding the maximum value of datetime. Result would be:     id home datetime player resource     1 10 04/03/2009 john 399   2 11 04/03/2009 juliet 244   5 12 04/03/2009 borat 555   8 13 01/01/2009 borat 700     I have tried: -- 1 ..by the MySQL manual:   SELECT DISTINCT   home,   id,   datetime AS dt,   player,   resource FROM topten t1 WHERE datetime = (SELECT   MAX(t2.datetime) FROM topten t2 GROUP BY home) GROUP BY datetime ORDER BY datetime DESC  Doesn't work. Result-set has 130 rows although database holds 187. Result includes some duplicates of home. -- 2 ..join  SELECT   s1.id,   s1.home,   s1.datetime,   s1.player,   s1.resource FROM topten s1 JOIN (SELECT   id,   MAX(datetime) AS dt FROM topten GROUP BY id) AS s2   ON s1.id = s2.id ORDER BY datetime   Nope. Gives all the records. -- 3 ..something exotic:   With various results.
libpng problems for QGIS I'm using ubuntu 18.04 and if I download QGIS 2.18 and I try to run it, I get this:  libpng warning: Application jmp_buf size changed Segmentation fault (core dumped)   If I try with QGIS 3.2, the error is:   libpng warning: Application was compiled with png.h from libpng-1.6.34 libpng warning: Application  is  running with png.c from libpng-1.2.56 libpng error: Incompatible libpng version in application and library   So it's clear that the problem is with libpng.   I purged libpng-dev and reinstall again but nothing changed.   I tried to purge libpng16-16 but I get:  sudo apt purge libpng16-16 Reading package lists... Done Building dependency tree        Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:  The following packages have unmet dependencies:  libgdk-pixbuf2.0-0 : Depends: libpng16-16 (&gt;= 1.6.2-1) but it is not going to be installed                       Recommends: libgdk-pixbuf2.0-bin  libgtk-3-0 : Depends: libcairo-gobject2 (&gt;= 1.10.0) but it is not going to be installed               Depends: libcairo2 (&gt;= 1.14.0) but it is not going to be installed               Depends: libfontconfig1 (&gt;= 2.12) but it is not going to be installed               Depends: libpango-1.0-0 (&gt;= 1.40.5) but it is not going to be installed               Depends: libpangocairo-1.0-0 (&gt;= 1.40.5) but it is not going to be installed               Depends: libpangoft2-1.0-0 (&gt;= 1.40.5) but it is not going to be installed               Depends: adwaita-icon-theme               Recommends: libgtk-3-bin E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.   and then:  ~$ sudo apt install libgdk-pixbuf2.0-bin libgtk-3-bin Reading package lists... Done Building dependency tree        Reading state information... Done libgdk-pixbuf2.0-bin is already the newest version (2.36.11-2). libgtk-3-bin is already the newest version (3.22.30-1ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~$ sudo apt install libgtk-3-0 libgdk-pixbuf2.0-0 Reading package lists... Done Building dependency tree        Reading state information... Done libgdk-pixbuf2.0-0 is already the newest version (2.36.11-2). libgtk-3-0 is already the newest version (3.22.30-1ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.   At this point I'm afraid of breaking something if I continue trying things, so I come here for advice before.  I deleted and reinstalled ubuntu. I installed first thing qgis and it was working. Afterwards I compiled gdal, from source to have it from python as stand alone. It might be this, but I had done this previously without any problems. Mounting filesystem with special user id set gnome-terminal instantly closes after messing with the profile settings I am using Gnome Terminal in Ubuntu 14.04 and I modified the profile preferences, setting it to start with a custom command instead of the default. I can't remember what that custom command was, but now when I launch the terminal, it instantly closes.   Is there any way to change the profile preferences in terminal without having it open? $$L~=~ \frac{1}{2} \dot{q}  \sin^2{q} $$  Is it zero or not defined? Given $y_n=(1+\frac{1}{n})^{n+1}$ show that $\lbrace y_n \rbrace$ is a decreasing sequence Given  $$ y_n=\left(1+\frac{1}{n}\right)^{n+1}\hspace{-6mm},\qquad n \in \mathbb{N}, \quad n \geq 1. $$ Show that $\lbrace y_n \rbrace$ is a decreasing sequence. Anyone can help ?  I consider the ratio $\frac{y_{n+1}}{y_n}$ but I got stuck. Why can you see virtual images? How do I compile a C# script at runtime and attach it as a component to a game object The idea here is to let users program the behaviour of an agent in a way that reminds of the "Screeps" game, where you get to develop code which later runs and dictates the behaviour of your units.  My idea is to let users develop the behaviour or their units with C# code, compile that code at runtime and attach it as a MonoBehavior to an existing game object.  How can I achieve this? How to recursively download a folder via FTP on Linux I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files. How do I access a specific element in a vector of vectors clojure I'm describing a situation that happened in the past. To explain it, I want to use a description that is both true now and true when the situation happened.  Specifically, I want something like:     She touched me where my neck met my collarbone.   Since my neck is still attached to my collarbone (thankfully), I'm wondering if I shouldn't use the present tense here instead:     She touched me where my neck meets my collarbone.   Which is preferable, and why? How to solve $\lim_{x \rightarrow 0} {\frac{(1+x)^a-1}{x}}$? How to solve this limit without using L'Hospital rule?  $$\lim_{x \rightarrow 0}{\frac{(1+x)^a-1}{x}}$$ Assuming String a and b:  a += b a = a.concat(b)   Under the hood, are they the same thing?  Here is concat decompiled as reference. I'd like to be able to decompile the + operator as well to see what that does.  public String concat(String s) {      int i = s.length();     if (i == 0) {         return this;     }     else {         char ac[] = new char[count + i];         getChars(0, count, ac, 0);         s.getChars(0, i, ac, count);         return new String(0, count + i, ac);     } } How to grep for text in a file and display the paragraph that has the text? Below is the text in the file:  Pseudo name=Apple Code=42B state=fault  Pseudo name=Prance Code=43B state=good   I need to grep for "42B" and get the output from the above text like:   Pseudo name=Apple Code=42B state=fault   Does anyone have idea on how to achieve this using grep/awk/sed? Asking distant cousins for DNA? In my family we have a DNA contradiction – two cousins (at about the 4th cousin level) took a Y-DNA test, but did not match and had two completely different haplogroups.   Since then, I have traced living cousins with the same surname – the only ones left living that I am aware of – and I would love to pay to have them tested to see if we can figure out where the non-paternity event (NPE) or other event happened (i.e. this new cousin could help us determine which line the NPE occurred in depending on which cousin he matches).   Does anyone have a sample letter, or know the best way to go about asking a distant cousin for DNA?   I have their address and am planning to write a letter, but I can't imagine receiving such a letter, so I am not quite sure how to ask without scaring them off. Correlation between dichotomous and continuous variable I am trying to find the correlation between a dichotomous and a continuous variable.  From my ground work on this I found that I have to use independent t-test and the precondition for it is that the distribution of the variable has to be normal.  I performed Kolmogorov-Smirnov test for testing the normality and found that the continuous variable is non-normal and is skewed (for about 4,000 data points).   I did the Kolmogorov-Smirnov test for the entire range of variables. Should I split them into groups and do the test? I.e., say if I have risk level (0 = Not risky, 1 = Risky) and cholesterol levels, then should I:    Divide them into two groups, like  Risk level =0 (Cholestrol level) -&gt; Apply KS Risk level =1 (Cholestrol level) -&gt; Apply KS  Take them together and apply the test? (I performed it on the whole dataset only.)   After that, what test should I do if it is still non-normal?    EDIT: The above scenario was just a description I tried to provide for my problem. I have a dataset which contains more than 1000 variables and about 4000 samples. They are either continuous or categorical in nature. My task is to predict a dichotomous variable based on these variables (maybe come up with a logistic regression model). So I thought the initial investigation would involve finding the correlation between dichotomous and a continuous variable.  I was trying to see how the distribution of the variables are and hence tried to go to t-test. Here I found the normality as an issue. The  Kolmogorov-Smirnov test gave a significance value of 0.00 in most of these variables.  Should I assume normality here? The skewness and kurtosis of these variables also show that the data is skewed (>0) in almost all cases.  As per the note given below I will investigate the point-biserial correlation further. But about the distribution of variables I am still unsure. Do there exist general conditions under which we can conclude that continuity on a topological space is detected by $\mathbb{R}$? Whenever $X$ is a topological space, let us say that continuity on $X$ is detected by $\mathbb{R}$ iff for all functions $f : X \rightarrow Y$ where $Y$ is another topological space, we have that if every continuous function $c : \mathbb{R} \rightarrow X$ satisfies "$f \circ c$ is continuous", then $f$ is itself continuous.   Clearly, continuity on $\mathbb{R}$ is detected by $\mathbb{R}$ It is shown  that continuity on $\mathbb{R}^2$ is detected by $\mathbb{R}$. Clearly, it is not the case that continuity on $\mathbb{Q}$ is detected by $\mathbb{R}$, since every continuous mapping $\mathbb{R} \rightarrow \mathbb{Q}$ is constant.      Question. Do there exist general conditions underwhich we can conclude that continuity on a topological space is detected by $\mathbb{R}$? How do you copy the contents of an array to a std::vector in C++ without looping? Is there a difference between the original file and a hard link to it? I'd like to synchronise some configuration files via a file hoster like Dropbox. I could create a hard link in the software's configuration folder and let it point to my cloud storage directory.  When having done that, is there a difference between those two files? I read somewhere that both files are attributes of the file in the master file table and that there would be no difference at all.  On the other hand, on Windows, directory junctions via mklink can be found using dir /AL /S, so they somehow differ from real directories.  Is that correct? What is the optimal order of post-processing steps? How to escape text for regular expression in Java