Skip to main content

Questions tagged [max]

Finding the maximum value in a group of items

0 votes
1 answer
175 views

With partitioned tables in SQL Server, there is a notorious major performance issue when using using min/max functions or TOP. Microsoft document workarounds for it here. I am confident that this was ...
J. Mini's user avatar
  • 1,418
-3 votes
3 answers
89 views

I have a grouped table that looks like this: End_of_Month_Date VersionId 2024-06-30 1 2024-06-30 2 2024-07-31 1 2024-07-31 2 2024-07-31 3 2024-07-31 5 For each month end, I want to pull in the Max(...
Daylon Hunt's user avatar
2 votes
2 answers
2k views

In MySQL I have tables, simplified as follows: companies (id, name, rank, trade_sector_id) orders (id, company_id, paid, subtotal) trade_sectors (id, label) companies_notes (id, company_id, notes) I ...
Ade's user avatar
  • 123
0 votes
0 answers
490 views

I'm using postgres with a jsonb field that looks something like this: {[[1.2, 'blah'], [3.4, 'blahhh']} I'm extracting the numbers by using: jsonb_path_query_array(json_row, '$[*][0]') Which gives ...
Nathaniel Bubis's user avatar
0 votes
2 answers
291 views

I am looking to pull a closing balance from the database for each month. I have tried SELECT CloseBal As 'Balance', MONTHNAME(DateTime) as 'Month', DateTime FROM Table1 WHERE MAX(DateTime) Group By ...
Paulmcf1987's user avatar
0 votes
0 answers
123 views

I have data in a table that has gotten cut up with multiple start and end dates. This is due to an error that has happened a few times in the last year. Apparently causing the system to not see the ...
daveyjones88's user avatar
1 vote
1 answer
225 views

We have a table partitioned on a two-year based hash function from the system date at the insertion time (let's call it PartitionKey). It also has a non-clustered index on a single field (Key). We ...
PM 77-1's user avatar
  • 123
0 votes
2 answers
641 views

I was supposed to use a script to get the MAX value from a table. It should have looked like this BEGIN DECLARE @MaxID AS INT SELECT @MaxID = MAX([Id]) FROM dbo.suggestion Insert into suggestion ...
ispostback's user avatar
1 vote
1 answer
394 views

Please bear with me as I am a beginner and could not find this answer elsewhere. I am working with employee data and need to determine which Product Group a given Team was associated with on the last ...
Ryan's user avatar
  • 13
-1 votes
2 answers
236 views

please help me write this query for MySQL. I want to select highest value from same datetime. So if there are multiple equal datetime value, return only one row with highest price. For summary, one ...
Sahasrar's user avatar
4 votes
2 answers
37k views

I'm trying to figure how to retrieve minimum/maximum values and minimum/maximum dates from a data set, but also the date value that corresponds to each minimum/maximum value. Example Data CREATE TABLE ...
Mr. Geologist's user avatar
1 vote
2 answers
5k views

Getting the second highest value from a table has been solved many times, but I'm looking for the second highest value in each group. Given this table: +----+-----+ | A | 10 | | A | 20 | | A | ...
RonJohn's user avatar
  • 714
0 votes
3 answers
312 views

I store the data from the rain gauge in mySQL and needed help with listing the data. I save the data every 5 minutes and use the save date in the form of a timestamp. At the end of each hour, ...
Novosad's user avatar
0 votes
3 answers
308 views

Database is MariaDB 10.3.25 I have 2 columns that are relevant: UserID and LastUpdate UserID consists of user@domain LastUpdate is a date field. Here is my issue - I have the current query: select a....
TheDemonLord's user avatar
2 votes
2 answers
3k views

I have an Azure Cosmos DB that contains columns DateTime, userName, temperature, and bloodPressure, plus many other columns. There are several distinct userName values, and each userName has ...
KAE's user avatar
  • 143

15 30 50 per page
1
2 3 4 5