Questions tagged [maxdate]

143 questions
1
vote
2 answers

SQL: SELECT rows with max date from created table

I´m wondering how to create a query that returns SERIALID, QTY, but only for the last INVOICEDATE. To combine information from two tables I use UNION. SELECT ab.SERIALID, ab.QTY, ab.INVOICEDATE FROM (SELECT a.INVOICEDATE, a.SERIALID, a.QTY …
1
vote
2 answers

How can I return one single row for each customer based on the latest date in BigQuery?

I have a table which contains data in the following structure. customer_id; status; date 1; 1; 01-01-2019 1; 3; 01-02-2019 2; 4; 01-02-2019 2; 3; 01-03-2019 What I want to…
Nienke Bos
  • 59
  • 1
  • 5
1
vote
1 answer

Counting only the MaxDate record in Oracle (Toad)

With appropriate apologies to everyone as this is my first post, I'm just back into SQL queries after having been away for two and half years. And even then I wasn't the best. I want a Distinct Count of Persons (SSN) by Service (SHORT_NAM) but I…
RodeDawg
  • 11
  • 1
1
vote
1 answer

Oracle table with only current records; reduce duplicates using max(date)

I need to create a new table in oracle with only the most current date for each record (step 1), and calculate days between (step 2). Your suggestions are greatly appreciated:))) Step 1: First I need to find the max (Mod_date) for each record from…
Lynn
  • 31
  • 1
  • 3
1
vote
2 answers

LEFT JOIN on Max Date value with ORDER BY id DESC

Suppose I have the following two tables: lead id(PK) status assigned_to date 1 open Smith 2018-08-26 2 open Drew 2018-08-26 3 new Amit 2018-08-26 lead_comments id lead_id(FK) comment_data …
amit gupta
  • 1,282
  • 2
  • 20
  • 36
1
vote
2 answers

SQL Server, select with group by and date column

I have tbl_Orders: OrderNumber ProductCode Qty OrderDate SentDate --------------------------------------------------------------- 1000 A 100 2018-03-01 00:30:51 2018-03-02 1000 A 150 2018-03-12…
damianm
  • 121
  • 1
  • 8
1
vote
1 answer

T-SQL Get last daily timestamp by ID

We have a table of user activities. Each activity is logged by userID, timestamp, and activityID. There can be multiple rows for each activityID by user each day. What we are trying to do is get the last time a specific activity was performed by a…
1
vote
2 answers

How to retrieve the latest and second latest date for each ID?

My SQL database looks like this ID DATE 1 2017-01-01 1 2017-01-03 1 2017-01-05 2 2017-01-06 2 2017-01-07 2 2017-01-08 2 2017-01-11 3 2017-01-11 How can I retrieve the Max(DATE) and second latest date for each ID as in below. ID MAXDATE …
1
vote
1 answer

SQL Left Outer Join but only pull max date

I noticed variations of this question has been asked but none seem to work for me (or I wasn't looking right). I'm still learning SQL so please bear with me. I have two tables I'm looking to join. I want all records from Table C and only ones that…
Rosadocc
  • 25
  • 3
1
vote
1 answer

SQL HELP getting duplicates when trying to get max(Date) for record

Need some help, here is my SQL below: I am getting duplicates back and it will not return my LastRespondedDate Field. Any help would be greatly appreciated. SELECT t.[column1], pr.[column1], pr.[RespondedDttm], t.[column2], …
1
vote
1 answer

Return Vales when

I'm stuck here, guys. I have two tables, each having a date column. One table is using timestamp (2016-08-05 09:16:11.000) the other has timestamp but isn't using it (2016-08-05 00:00:00.000) I want to join these tables and return the MAX date…
1
vote
2 answers

SQL Server 2012 Max Date in Subquery in a joined table

I manage a state wide application and use Tableau to create visualizations of data. I have been tasked with creating a visualization that show how much time is passing between contact entries and today (Case Note Dates). I know how to isolate the…
Mike
  • 13
  • 4
1
vote
3 answers

Select multiple rows from a table where field is the max date

I have a table called Product. I need to select all product records that have the MAX ManufatureDate. Here is a sample of the table data: Id ProductName ManufactureDate 1 Car 01-01-2015 2 Truck 05-01-2015 3 Computer …
William Venice
  • 329
  • 2
  • 7
  • 16
1
vote
5 answers

Select max date and the date before

I have a data table which is updated every day except Saturday and Sunday. The problem lies in so that when I retrieve data with max (date) and max (date) -1 But it fails when I try to retrieve data for today (Monday) and yesterday (Sunday) when max…
1
vote
1 answer

Calendar Activity NullPointerException setting minDate and maxDate

I get a NullPointerException when I set minDate and maxDate in onCreate of a CalendarActivity. I am desperate looking for the solution. When I comment minDate and maxDate lines there is no problem. I call Calendar with a date range (taked with an…
Roberto Alonso
  • 1,181
  • 1
  • 7
  • 9
1 2
3
9 10