2015-09-01 20 views
0

我想從兩個表中得到一個表格的時間,但我需要的記錄,在同一日期不受時間從兩個表,其中日期是相似的,但選擇刪除

select * 
from Transactions , SellerIPLogins 
where Transactions.SellerId =SellerIPLogins.SellerId 
    and Transactions.SellerId=3141 and Transactions.Payment>1 
    and **Transactions.Date=SellerIPLogins.Date** 
order by Transactions.Date desc 

回答

1

使用Convert同步方法將日期時間轉換爲日期:

select * 
    from Transactions , SellerIPLogins 
    where Transactions.SellerId =SellerIPLogins.SellerId 
     and Transactions.SellerId=3141 and Transactions.Payment>1 
     and Convert(date,Transactions.Date)=Convert(date,SellerIPLogins.Date) 
    order by Transactions.Date desc 
+0

這不是一個很好的答案。請發佈說明,而不僅僅是代碼。 –

+0

@JamieRees,好吧,但實時回答最好的方法是發佈一個簡短的答案,然後在稍後編輯它以獲得完整的答案。 –

+0

感謝禮薩它完美的工作 –

相關問題