我想合并几个表字段,以产生一个组合值。
下面是我的代码:
from _showtime in db.tbl_Concert_Showtime join _concerthall in db.tbl_Concert_ConcertHall on _showtime.ConcertHallID equals _concerthall.ConcertHallID
join _hall in db.tbl_Concert_Hall on _concerthall.HallID equals _hall.HallID
join _hallfloor in db.tbl_Concert_Hall_Floor on _hall.HallID equals _hallfloor.HallID
join _place in db.tbl_Concert_Hall_Floor_Place on _hallfloor.FloorID equals _place.FloorID
where _place.PlaceID == id
select _showtime
showtime
表包含showID
、startdate
、starttime
和endtime
字段。
如何在字段中选择startdate
和starttime
?
像这样:2015/12/12 12:25 -> 12:58
from _showtime in db.tbl_blablabla
select _showtime.startdate + " " + _showtime.starttime + " -> " + _showtime.enddate
如果你想保留原来的Showtime对象,但只添加组合值,请执行如下操作:
from _showtime in db.tbl_blablabla
select new
{
Showtime = _Showtime,
CombinedValue = _showtime.startdate + " " + _showtime.starttime + " -> " + _showtime.enddate
}