groupwise-maximum Questions
34
Solved
There is a table messages that contains data as shown below:
Id Name Other_Columns
-------------------------
1 A A_data_1
2 A A_data_2
3 A A_data_3
4 B B_data_1
5 B B_data_2
6 C C_data_1
If I ru...
Epilate asked 21/8, 2009 at 17:4
9
Solved
I read many threads about getting only the first row of a left join, but, for some reason, this does not work for me.
Here is my structure (simplified of course)
Feeds
id | title | content
-----...
Afternoons asked 25/3, 2013 at 23:6
7
Solved
I have an employee table with a name and a salary.
I want to print these 2 columns with only 2 records in them, the name of my highest and lowest payed employee.
It should look something like thi...
Tamikotamil asked 19/2, 2019 at 23:12
27
Solved
I have this table for documents (simplified version here):
id
rev
content
1
1
...
2
1
...
1
2
...
1
3
...
How do I select one row per id and only the greatest rev?
With t...
Garton asked 12/10, 2011 at 19:42
6
Solved
a.2<-sample(1:10,100,replace=T)
b.2<-sample(1:100,100,replace=T)
a.3<-data.frame(a.2,b.2)
r<-sapply(split(a.3,a.2),function(x) which.max(x$b.2))
a.3[r,]
returns the list index, not ...
Scarletscarlett asked 12/5, 2010 at 19:35
5
Solved
I have the following table:
CREATE TABLE orders (
id INT PRIMARY KEY IDENTITY,
oDate DATE NOT NULL,
oName VARCHAR(32) NOT NULL,
oItem INT,
oQty INT
-- ...
);
INSERT INTO orders
VALUES
(1, ...
Bicorn asked 5/2, 2016 at 8:17
2
Solved
I need to find a running maximum of a variable by group using R. The variable is sorted by time within group using df[order(df$group, df$time),].
My variable has some NA's but I can deal with it b...
On asked 3/12, 2015 at 15:14
4
Solved
select *
from records
where id in ( select max(id) from records group by option_id )
This query works fine even on millions of rows. However as you can see from the result of explain statement:...
Afield asked 16/6, 2014 at 12:42
4
Although this question looks simple, it is kind of tricky.
Consider the following table:
CREATE TABLE A (
id INT,
value FLOAT,
"date" DATETIME,
group VARCHAR(50)
);
I would like to ...
Mussman asked 18/12, 2008 at 0:17
5
Solved
Let's say I have a payments table like so:
CREATE TABLE Payments (
PaymentID INT,
CustomerID INT,
Value INT,
PaidOn DATE
);
INSERT INTO Payments
VALUES
(1, 1, 5, '2000-01-01'),
(2, 1, 10, '20...
Callen asked 17/12, 2008 at 17:3
1
© 2022 - 2024 — McMap. All rights reserved.