Josef Bar
Josef Bar

Reputation: 1

Select from two tables where date are similar but remove the time

I'm trying to get one table from two tables but I need the records to be synchronized by the same date without the time

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

Upvotes: 0

Views: 39

Answers (1)

Reza ArabQaeni
Reza ArabQaeni

Reputation: 4908

Use Convert method to convert datetime to date:

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

Upvotes: 1

Related Questions