![](/img/trans.png)
[英]How to join every row from one table, with the latest dated row from another table, using LINQ2SQL
[英]i want to join every row of a table with another one in a specific order
我有 2 張桌子:
years:
id name
1 2022
2 2023
3 2024
4 2025
5 2026
和月份:
id name
1 jan
2 feb
3 mar
4 月 4 日 6 月 5 日 7 月 6 日 ...
我想加入從幾年到幾個月的每一行。 像這樣的東西:(使用此命令)
2022 jan
2022 feb
2022 mar
2022 apr
...
2023 jan
2023 feb
....
請幫忙
那是交叉連接(笛卡爾積)。
select y.name as year,
m.name as month
from years y cross join months m
order by y.name, m.id
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.