2015-11-11 70 views
0

我的問題是,我想實現一個查詢,並引發語法錯誤。我發現在查詢設計器中沒有辦法做到這一點,我認爲,我只能通過直接編寫sql代碼來實現。訪問語法錯誤問題

我的代碼是:

select distinct Daily_Output20151013.[Lot No], 
    atabla.[Outgoing date] as ext1date, 
from (Daily_Output20151013 
inner join (select Daily_Output20151013.[Lot no] from (Daily_Output20151013.[Outgoing date] 
where Daily_Output20151013.[Process Pattern] = 'a') as atabla 
on Daily_Output20151013.[Lot No] = atabla.[Lot No]) 

這些現有的表和記錄,除了atabla這將是輸出表。

錯誤消息是:「FROM子句中的語法錯誤」。

預先感謝您。

回答

1

您在Daily_Output20151013之後還有額外的(。刪除它。這應該工作。

select distinct Daily_Output20151013.[Lot No], 
atabla.[Outgoing date] as ext1date 
from (Daily_Output20151013 
inner join (select [Lot no], [Outgoing date] 
      from Daily_Output20151013 
      where Daily_Output20151013.[Process Pattern] = 'a') as atabla 
on Daily_Output20151013.[Lot No] = atabla.[Lot No]) 
+0

謝謝你,但它拋出:「選擇包含佔用或無效的字或參數「 –

+0

如果我是正確的,dervied表應該使用'Daily_Output20151013'表。你是否嘗試過最新版本的答案? –

+0

是的,你是絕對正確的。該表的名稱是Daily_Output20151013。我試過了,但失敗了。 –

0

它拋出,因爲之前的逗號從線的誤差2

正確的代碼是:

select distinct Daily_Output20151013.[Lot No], 
atabla.[Outgoing date] as ext1date 
from Daily_Output20151013 
inner join (select [Lot no], [Outgoing date] 
     from Daily_Output20151013 
     where Daily_Output20151013.[Process Pattern] = 'a') as atabla 
on Daily_Output20151013.[Lot No] = atabla.[Lot No]