I have a table like this, named Tour Details
.
| dealdate | Tours | Weeknumber | Country | SubVenue |
| ------------ | ------------ | ------------ | ------------ | ------------ |
| 2022-01-12 | 3 | 49 | India | SP1 |
| 2022-11-25 | 4 | 48 | India | SP2 |
| 2022-10-14 | 5 | 42 | India | SP3 |
| 2023-01-05 | 3 | 2 | India | SP1 |
| 2023-01-05 | 4 | 2 | India | SP2 |
| 2023-01-06 | 5 | 2 | US | SP1 |
| 2023-02-24 | 3 | 9 | US | SP2 |
| 2022-02-12 | 4 | 7 | US | SP3 |
| 2023-02-19 | 5 | 8 | US | SP1 |
| 2023-02-27 | 6 | 10 | US | SP2 |
I need to create a table summary tour details
. This table should have information like the DAY
, WEEK
, MONTH
, YEAR
derived from the dealdate
from Tour Details
for every record in the column SubVenue
.
Grp | Day | Week | Month | Year |
---|---|---|---|---|
Tours SP1 | 1 | 49 | 12 | 2022 |
Tours SP2 | 3 | 50 | 11 | 2023 |
Tours SP1 | 2 | 3 | 1 | 2022 |
Tours SP3 | 12 | 4 | 2 | 2023 |
Any help would be greatly appreciated
1条答案
按热度按时间ghhaqwfi1#
This is an example for datatype
date
. But it will also work forvarchar
.