我是用老師教的Editplus寫的
裡面有兩個資料表
[Menudata]
(MealNumber) (SNumber) (Classification) (MealName) (Price)
[nReservedata]
(SNumber) (Odnumber) (MealNumber) (amount) (UAccount) (tmealday) (tmealtime) (Price) (Total) (OfferID) (IO)
該怎麼用兩個資料表都有的(MealNumber)欄位去做關聯
然後select出來
(Odnumber)(UAccount)(tmealday)(tmealtime)(OfferID)(MealName)(amount)(Price) (Total)這些欄位??
祝各位新年快樂!!
SELECT b.Odnumber,b.UAccount,b.tmealday,b.tmealtime,
b.OfferID,a.MealName,b.amount,a.Price,b.Total
FROM Menudata a INNER JOIN nReservedata b ON a.SNumber = b.SNumber
以上
我現在成功可以兩個資料表關聯了
但不知道如何做WHERE條件
我要只顯示(SNumber=A001)的值
SELECT nReservedata.Odnumber,nReservedata.UAccount,nReservedata.tmealday,nReservedata.tmealtime,nReservedata.OfferID,Menudata.MealName,nReservedata.amount,nReservedata.Price,nReservedata.Total
FROM nReservedata
INNER JOIN Menudata
ON nReservedata.MealNumber=Menudata.MealNumber;
SELECT b.Odnumber,b.UAccount,b.tmealday,b.tmealtime,
b.OfferID,a.MealName,b.amount,a.Price,b.Total
FROM Menudata a INNER JOIN nReservedata b ON a.SNumber = b.SNumber
WHERE a.SNumber = 'A001'
感謝你!! 新年快樂^^
上網查一下 INNER JOIN
那請問如果要在裡面加上WHERE條件式怎麼加上0.0?
我現在成功可以兩個資料表關聯了
但不知道如何做WHERE條件
我要只顯示(SNumber=A001)的值
SELECT nReservedata.Odnumber,nReservedata.UAccount,nReservedata.tmealday,nReservedata.tmealtime,nReservedata.OfferID,Menudata.MealName,nReservedata.amount,nReservedata.Price,nReservedata.Total
FROM nReservedata
INNER JOIN Menudata
ON nReservedata.MealNumber=Menudata.MealNumber;