Assume your name is named tablename
, you may try this query:
SELECT customer_key
FROM (
SELECT customer_key, max(order_date) as max_date
FROM tablename group by customer_key
) a
WHERE a.max_date < (sysdate - 60);
More Related Contents:
- How to get percentages of maximum counts?
- Sql to select the rows and ignore the duplicate userid in SQL Server [closed]
- i want to update table multiple row using IN statement
- Can anyone help me to get the query to retrieve data like below [closed]
- Select first row in each GROUP BY group?
- Is there any rule of thumb to construct SQL query from a human-readable description?
- MySQL LIKE IN()?
- How to use RETURNING with ON CONFLICT in PostgreSQL?
- Optimal way to concatenate/aggregate strings
- How can I list the tables in a SQLite database file that was opened with ATTACH?
- How can I see the raw SQL queries Django is running?
- Maximum size for a SQL Server Query? IN clause? Is there a Better Approach [duplicate]
- Convert varchar into datetime in SQL Server
- Doing a WHERE .. IN subquery in Doctrine 2
- Case expressions in Access
- How do I count unique items in field in Access query?
- Fastest way to perform nested bulk inserts with scope_identity() usage?
- Can we use join for two different database tables?
- Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement
- SQLite – ORDER BY RAND()
- How can I select from list of values in Oracle
- Why are logical reads for windowed aggregate functions so high?
- How to convert Rows to Columns in Oracle? [duplicate]
- SQL Keep getting error with ON UPDATE CASCADE
- Select corresponding to row from the same table SQL Server
- Upsert with a transaction
- Update rows in one table with data from another table based on one column in each being equal
- How to include excluded rows in RETURNING from INSERT … ON CONFLICT
- Display next event date
- Sql query for tree table