Adri2o
Adri2o

Reputation: 1

MySql: Select from a table when week is actual week, and the week before

I have a table where a column is "Week", and I want to select all the rows of the table where "Week" is the current week and also the week before.

For instance, today is 15/02/2017 so, it is week 7. I want to select all the rows where "Week" Between 6 and 7 , but without writting the numbers, so it will change with the current week.

Thank you very much.

Upvotes: 0

Views: 44

Answers (1)

Hexxed
Hexxed

Reputation: 683

Try this.

SELECT * FROM TBL
WHERE [WEEK_COLUMN] BETWEEEN WEEK(CURDATE())-1 AND WEEK(CURDATE())

Upvotes: 3

Related Questions