| Body |
|---|
| Beta M yy-Tz |
| Beta M zz-Ox |
| Beta W yy-Tz |
| Tiger W Dash |
| Tiger M Dash |
| Tiger White Stone W Pearl |
| Tiger White Stone M Pearl |
I have a column 'Body' in a snowflake table xyz which contains the products being ordered. The 'Body' field is composed of three parts.
1st part: Product Name (Ex: Beta, Tiger, Tiger White Stone)
2nd part: Gender M or W and
3rd part is internal product naming (Ex: yy | Tz, zz | Ox, Dash and Pearl).
I want to extract the M and W in the separate column named Gender to know how many men and women customers I have.
Expected output:
| Gender |
|---|
| M |
| M |
| W |
| W |
| M |
| W |
| M |
I tried to use the split function but I feel it is not an efficient way. Is there a better way to get this implemented?