user14186915
user14186915

Reputation: 23

Select distinct and add one to that value

I have a database with a column containing year-week in this format "202030, 202031" and so on. However the weeks are US-format and to be in Swedish format I need to add 1 to this integer.

I have this query that works but gives me the "wrong week": Select distinct date_week FROM table Order by date_week desc

I have tried this without success: Select distinct date_week +1 FROM table Order by date_week desc

How do I add +1 to the volumes in that date-week column?

Upvotes: 2

Views: 66

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1271151

Does this do what you want?

select date_week + 1 
from table 
group by date_week
order by date_week desc;

You don't specify the issue with your query, but it might simply be the select distinct.

Upvotes: 1

Related Questions