티스토리 뷰
C# LINQ Left join of DataTables
Join 키가 두개일경우
on new { X1 = tb1.Field("ids"), X2 = tb1.Field("tdate") }
equals new { X1 = tb2.Field("ids"), X2 = tb2.Field("odate") }
_____________________________________________________________________________________________________________________
var query1 = from tb1 in DT1.AsEnumerable()
join tb2 in DT2.AsEnumerable()
on new { X1 = tb1.Field<string>("ids"), X2 = tb1.Field<string>("tdate") }
equals new
{ X1 = tb2.Field<string>("ids"), X2 = tb2.Field<string>("odate") }
into dataKey
from tbResult in dataKey.DefaultIfEmpty()
select new
{
IDS = tb1.Field<string>("ids"),
NAMES = tb1.Field<string>("nm"),
DATES = tb1.Field<string>("dts"),
DNAME = tb1.Field<string>("ynm"),
CHNUM = tb1.Field<string>("cnum"),
T1 = tb1.Field<string>("t1"),
T2 = tb1.Field<string>("t2"),
T3 = tb1.Field<string>("t3"),
T4 = tb1.Field<string>("t4"),
T5 = tb1.Field<string>("t5"),
T6 = tb1.Field<string>("t6"),
T7 = tb1.Field<string>("t7"),
T8 = tb1.Field<string>("t8"),
T9 = tb1.Field<string>("t9"),
T10 = tb1.Field<string>("t10"),
InTime = (tbResult == null ? null : tbResult.Field<string>("tTime")),
OutTime = (tbResult == null ? null : tbResult.Field<string>("oTime")),
};
// query1 --> joined DataTable
DataTable NDT = new DataTable();
NDT.NewRow();
NDT.Columns.Add("IDS", typeof(string));
~
~
foreach (var r in query1)
{
DataRow DR = NDT.NewRow();
DR["IDS"] = r.IDS;
~
~
NDT.Rows.Add(DR);
}
'WPF' 카테고리의 다른 글
Radio Button/ CheckBox Null Check (0) | 2022.06.20 |
---|---|
C# DataTable AsEnumerable Sum, Count Linq쿼리 (0) | 2022.02.14 |
RF Card Serial DataReceived Split Byte Process (0) | 2021.12.21 |
C# Multiple Order By with LINQ (1) | 2021.06.25 |
Mysql Aes_Encrypt 쿼리 == C# Encrypt String(HEX) (3) | 2021.06.14 |
- Total
- Today
- Yesterday
- Entry '' has empty native path
- Label Text LineBreak in Xaml
- c# Encrypt / Decrypt
- Microcharts
- Xamarin Firebase Phone User Add
- Xamarin.Ios Firebase Phone User Add
- 암호 마스터키
- GetCellContent CheckBox Value
- 연산자 뒤에 피연산자가 없습니다.
- C# LINQ Left join
- FileStream Add Byte
- Xamarin Firebase Phone Auth
- 서버 수준의 URN 필터
- Xamarin.Ios Firebase Phone SMS OTP Send
- WPF Textbox
- Xamarin reCAPTCHA
- Windows IIS FTP 디렉토리 목록 오류
- ClickOnce 인증서 인증기간 변경
- WPF Scrollviewer in ScrollViwer
- Linux SSH Multi Computer Join
- Xamarin.Forms
- SkiaSharp
- Xamarin.Ios Firebase Phone Auth
- Embeded 한글Font적용
- ssl_client_socket_impl.cc
- WPF Datagrid Cell Value Change
- Xamarin SMS OTP Send
- WPF Excel Export Microsoft.Office.Interop 성능향상(열 기준으로 복사)
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |