Join two tables where table A has a date value and needs to find the next date in B below the date in A

后端 未结 3 1347
情深已故
情深已故 2021-01-26 12:50

I got this table \"A\":

| id | date       |
===================
| 1  | 2010-01-13 |
| 2  | 2011-04-19 |
| 3  | 2011-05-07 |
| .. | ...        |

3条回答
  •  清歌不尽
    2021-01-26 13:37

    The INNER JOIN return rows when there is at least one match in both tables. Try this.

    Select A.id,A.date,b.value 
    from A inner join B 
    on A.date=b.date 
    

提交回复
热议问题