Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Query: Select most recent entry for each distinct field value?
    primarykey
    data
    text
    <p>i have this table POSITION: </p> <pre><code>CREATE TABLE `position` ( `idposition` bigint(20) NOT NULL AUTO_INCREMENT, `latitude` varchar(45) DEFAULT NULL, `longitude` varchar(45) DEFAULT NULL, `timestamp` datetime DEFAULT NULL, `fk_email` varchar(100) DEFAULT NULL, </code></pre> <p>with this population: </p> <pre><code>idposition latitude longitude timestamp fk_email 1 39.49333 -0.33667 2010-12-10 17:15:39 david@test.es 4 39.47333 -0.36167 2010-12-11 09:58:47 ronald@test.es 5 39.50333 -0.34267 2010-12-10 21:11:10 david@test.es 10 39.44333 -0.41667 2010-12-12 18:17:26 fanny@test.es 11 39.45199 -0.31967 2010-12-12 21:01:18 victor@test.es 12 39.52133 -0.36167 2010-12-12 17:43:11 carlos@test.es 13 39.43199 -0.31967 2010-12-14 15:45:25 victor@test.es 14 39.41199 -0.34567 2010-12-14 20:46:09 victor@test.es 15 39.43433 -0.41667 2010-12-14 17:29:39 maria@test.es 16 39.44133 -0.42667 2010-12-12 19:17:33 maria@test.es 17 39.50333 -0.35667 2010-12-13 16:36:22 angel@test.es 196 39.46454 -0.38978 0000-00-00 00:00:00 fanny@test.es 271 33.63883 -0.45024 2010-12-17 11:36:45 fanny@test.es 273 39.46680 -0.39452 2010-12-20 00:00:00 fanny@test.es 441 39.44133 -0.41467 2010-12-15 17:45:13 carlos@test.es 5326 39.47316 -0.38351 2011-01-18 18:09:56 pablo@upv.es </code></pre> <p>ok, i want to make SQL Query, that returns to me THE LAST (NEWEST) POSITION OF EACH FK_EMAIL, i mean, for each <code>fk_email</code>, the position with the last (newest) <code>timestamp</code>, only one position (te last) for each email.</p> <p>it is possible to do it? can someone help me with the query? is too munch hard for me</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload