Skip to content
Advertisement

How to get the latest date time record in an sql query with a where clause?

I have two tables : RO_LAMEL_DATA and RO_MAIN_TABLE. RO_MAIN_TABLE includes all the serial numbers (serial_nr) for the productions which have a record key (record_key). RO_LAMEL_DATA has several records (on the same day) for each record key such as machine status (machine_status) with a date time value (pr_date_time). I want to get the latest machine status of one production. For this I do:

However I get the error:

single-row subquery returns more than one row

How can I solve this? Thanks in advance!

Advertisement

Answer

Maybe you need something like

fiddle

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement