次の列のテーブルがあります
inspection_dt,
contact_dt,
description,
product_mod,
product_desc,
contact_nm,
history_id,
inspect_id,
history_type,
incident_product_id,
contact_history_id
LINQを使用して、このテーブルの行の一般的なリストをクエリします。ツイストは、history_idの最小(MIN)値が必要であり、このSQLクエリを模倣することです。
SELECT DISTINCT
inspection_dt,
contact_dt,
description,
product_mod,
product_desc,
contact_nm,
MIN(history_id) AS history_id,
inspect_id,
history_type,
incident_product_id,
contact_history_id
FROM
myTable
GROUP BY
inspection_dt,
contact_dt,
description,
product_mod,
product_desc,
contact_nm,
inspect_id,
history_type,
incident_product_id,
contact_history_id
私は次のようなスニペットを試しました
var searchData = items
.GroupBy(i => new { i.history_id })
.Select(g => new { history = g.Min() })
.Distinct();
しかし、それでもすべてを台無しにする
MIN、MAXなどの関数を使用して行き詰まり、LINQでグループ化するので、助けていただければ幸いです。
ありがとう、