Skip to content
Advertisement

Tag: max

Get max date based on another column in SQL

I have a table variable which consists of columns id, date and status as shown below And follows is the sample data Also declared a variable as shown below. From this table I need to get the row which containing the maximum value of date( MAX(dates) ) where status is ‘ABC’, from the above sample values, I should get the

SQL query for entries of last N jobs

I have the following table: etc, so basically jobs keep adding entries concurrently I am looking for an efficient query to return all entries of the latest (by time) N jobs So find the first (by time) entry for each job, then using that get the latest N jobs with all their entries So for the above table and N=3

sql Select the max value within a combination of starting time and ending time

I have a database as the data table below. Its a standard Open High Low Close Database. I wanna select the date, start-time, end-time, max([high] over ***The period of time) , and Close Data Table date time high 20100104 94000 21850 20100104 94500 21903 20100104 95000 21875 20100104 95500 21855 20100104 100000 21904 20100104 100500 21922 20100104 101000 21935 20100104

Select max date per year

I have the table as follows: And I’d like to select the max date for every year per user, so the result would be like: Some help? Thank you! Answer Just use aggregation: If you have more columns that you want, then use distinct on:

Stuck to select maximum row

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

Advertisement