Skip to content

Tag: sql

SQL: Choose latest uploaded data

I am seeing duplicates in my data after running my sql query, and have figured out the issue stemming to our data team not updating a table but adding a new row instead. In this instance, I need to use the largest LD_SEQ_NBR to get the latest data. Given the following table — ORDERS What do I need to ad…

joining temporal tables in oracle

I am looking for better solutions to a fairly generic problem with temporal tables. say we have table_a (some_value int, date_from date, date_to date) and a series of similar tables table_b, table_c, …

strftime() with not giving the correct results

I have this table: I need a way to only show records besides the current month and year. example: today is 2021-01-08 I only need to see records besides month 01 and year 2021 This is my sql fiddle playground I do not understand why it doesn’t output the result I want. I need it to show me this: Answer

How to combine two queries? MySQL

How can i combine my two queries? 1: This query is finding dialogs where more than 10 messages and lasted more than an hour. 2: The second query selects two last rows for each dialogs. So, what i want is select last two rows for each dialogs that lasted more than an hour and where more than 10 messages. I