2
Dim LocationList =
From rows In db.Locations, clientRow In db.Clients, stateData In db.Ref_States
Where rows.State = stateData.ID
Select ClientName = clientRow.Name, rows.ID, rows.Address1, rows.Address2, rows.City, StateName = stateData.Name, ShortStateName = stateData.ShortName, rows.ZipCode Order By Address1
这就是我的,这是非常错误的。一切都显示出来了,但数据显示不正确,显示的行比现有的多。如何从两张表格中获取我的信息?
我想我可能有它,但你可以看看我的代码,并告诉我,如果你看到任何问题?
Dim LocationList =
From rows In db.Locations, clientRow In db.Clients, stateData In db.Ref_States
Where rows.State = stateData.ID And rows.ClientID = ucClientID And rows.ClientID = clientRow.ID
Select ClientName = clientRow.Name, rows.ID, rows.Address1, rows.Address2, rows.City, StateName = stateData.Name, ShortStateName = stateData.ShortName, rows.ZipCode Order By Address1
在位置表'状态'有来自Ref_State表的编号 – Landmine 2012-02-09 02:34:59
我得到了它的工作,但是我怎样才能从2个表中提取数据?我尝试添加另一个JOIN,但它不起作用。 – Landmine 2012-02-09 03:14:05
你想从中选择数据还有哪些表(除了位置和Ref_State)?如果您提供一些额外的信息,我可能会提供帮助。 – 2012-02-09 03:41:50