从内部联接检索最新记录 table

Retrieve newest record from inner join table

目前正在使用内部连接拉取交易记录。这导致联接的左侧为每个右侧 table 值的 return 值。
*如果没有内连接,单个记录将从左侧table编辑return。
对于内部联接右侧 table,左侧记录正在为每个右侧记录 returned。

Do you know how to distinguish the "newest" record from the right table? Is there any timestamp column, ID or something like that?

是的,有序号。

理想的解决方案是 return 左边只有一行,右边是最新的记录 table。

缺乏细节,但希望你能适应这个:

SELECT
  table_with_one_row t
  INNER JOIN
  (
    SELECT u.*, ROW_NUMBER() OVER(PARTITION BY id_group ORDER BY sequence_number DESC) rn
    FROM 
      table_with_multiple_rows_per_row_in_t u
  ) x
  ON
    t.id = x.id_group AND x.rn = 1