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