2014-02-11 46 views
0

我已被分配了一個查詢來提取以下內容:不知道如何寫查詢的一部分

由廣告客戶輸入的訂單自12/18/2013創建。

我有這個到目前爲止,但我錯過了FROM片。

Select 
    WO_STATIONS.station_call_letters as "Station" 
    ,WO_ORDERS.ORDER_NUMBER as "Order" 
    ,WO_ADVERTISERS.advertiser_name as "Advertiser" 
    ,WO ADVERTISERS.TCODE as "Adv Num" 
    ,WO_ORDERS.FLIGHT_START_DATE as "Order Start" 
    ,WO_ORDERS.FLIGHT_END_DATE as "Order End" 
    ,WO_ADVERTISERS.CREATE_DATE AS "ADV CREATED" 

FROM 

WHERE 
     WO_ADVERTISERS.CREATE_DATE > '12/18/2013' 
+2

安置自己的模式,並表示主要 - 外鍵關係。 –

+0

您能否指出您正在使用哪個數據庫? –

回答

0

它可能看起來有點像這樣:

Select 
    WO_STATIONS.station_call_letters as "Station" 
    ,WO_ORDERS.ORDER_NUMBER as "Order" 
    ,WO_ADVERTISERS.advertiser_name as "Advertiser" 
    ,WO ADVERTISERS.TCODE as "Adv Num" 
    ,WO_ORDERS.FLIGHT_START_DATE as "Order Start" 
    ,WO_ORDERS.FLIGHT_END_DATE as "Order End" 
    ,WO_ADVERTISERS.CREATE_DATE AS "ADV CREATED" 

FROM 
    WO_ORDERS inner join WO_STATIONS on WO_ORDERS.StationId = WO_STATIONS.StationId 
    inner join WO_ADVERTISERS on WO_ADERTISERS.AdvertiserId = WO_ORDERS.AdververtiserId 
WHERE 
     WO_ADVERTISERS.CREATE_DATE > '12/18/2013' 

您的數據庫工具有建築物查詢或視圖的圖形用戶界面?如果是這樣,您可以將三個表添加到查詢工具。如果你的數據庫有外鍵,那麼這個工具會自動爲你創建FROM子句。如果不是,則可以將一個表的主鍵拖放到另一個表的外鍵。

嘗試這些資源的更多信息,加入: Access SQL

我也推薦一本好書對SQL,如:SQL Step by Step