SQL code does not work wanted an explanation of why the code error?

Asked

Viewed 79 times

0

Tabelas SQL

I received these two tables in an exercise, but my code isn’t working and I was wondering if someone could explain it to me. I have to submit all orders created in the last 10 days.

My code:

Select id-order, createdDate
From Date
Where Date = 'createDate' in <10 days

Only it doesn’t work.

  • What the SGBD? MySQL, SQL Server, Oracle?

  • SQL server.....

1 answer

0


Apparently what you need to do is something like this:

SELECT 
    ID-ORDER, CREATEDDATE
FROM
    ORDER
WHERE 
    DATEDIFF(DAY,CREATEDDATE,GETDATE()) < 10
  • So I need to use Datediff in all cases like this?

  • In most cases, which makes period comparison between dates I believe is the best option.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.