I have a table with columns: I need to select row with maximum value, and show info like I tried using group function MAX(), but I can’t select fullname, because if I use it as a GROUP BY expression, it will select max in groups. Other way, is to use WITH statement, order table by value desc, use function and
Tag: max
SQL query to get top performer statistics per year (eg 3 pointers)
I have a table with players per year and some stats. For example (player_key, player_name, year, 3point_trials, 3point_score) I want to have as an ouput the top performer per year (3point_score/3point_trials). If two of them have the same % then the breakeven is the the 3point_trials, whoever has the most trials. Output would be per year what is the SQL
I’m looking for a pair of SQL functions (MS SQL Server) that will return the MAX or MIN of a list of dates
I’m looking for a pair of SQL functions that will return the MAX and MIN value of a list of dates (or, alternatively, the MAX and MIN of two dates – I can then stack the calls to handle the whole list)…
How do I get the lates tm.detail_notes ( tm.detail_notes for max(tm.timeslip_date))?
I have a query that return some record, but I need to get whatever the latest tm.detail_notes on max(tm.timeslip_date). Right now I am getting an error. (I have multiple record dates on the table and each day have note) Query Error The text, next, and image data types cannot be compared or sorted, except when using IS NULL or LIKE
PostgreSQL cross join using max returns null
I want to select the max() value of the modified_at column in each of several tables: This works correctly as long as each of the tables has at least 1 row. The problem is that when just one of the tables has 0 rows, null is returned for all tables: What is a solution that returns the correct values for
Oracle SQL: how to show only one max per group
Hi everyone first thanks for your time. I have this data Data: And I have to obtain the max values of everygroup, if there is one group that has two same max values like A 40 23/56/1982 A 40 31/4/…
Postgres select * after groupby and max
Consider a table with an id PK and 26 columns. There is an index on (a,b) I’m trying to select the row where the unique pairing of (a,b) is most recent. IE what was the last record for each (a,b) Because ID is autoincrementing, know that the max is the last row. However, is there any way to have the
Sql query with max value in where condition
I have a query which should return one row if the conditions are met. This query compares columns from 3 tables and should use the max value of DEGREE_HIERARCHY since there can be more than one value. …
SQL nested query and use of MAX to extract most recent transaction and/or comment
We have a SQL database table recording customer comments (ARCMM). I want to extract the most recent comment for each customer. Some customers do not have any comments (i.e. no entries in ARCMM). The most recent comment for a customer will have the most recent date (field DATEENTR) and, for that date, the highest value of field CNTUNIQ. The query
SQL subquery with aggregate value
Sorry for the vague title, I’m a little lost here. I have two simple aggregate SQL queries, but I struggle to combine them in a functional way (likely through a subquery) in IBM DB2. Main goal is to run COUNT function in INVOICES table – but with the starting date based on a subquery MAX aggregate result. But as noted,