I have two columns in my table called tshirtsize and tshirtcolor, which I want to encode into a 3 character code.
[Sleeve][Size][color]
[S|L] [1-6] [B|G]
where
tshirtsize = 'Short Sleeve M'
tshirtcolor = 'Stonewashed Blue'
result should be:
S2B
I would like to do this in sql.
Here is what I have so far.
How do I combine these statements to encode the data in the table.
select tshirtsize, 'S' as sleevecode from ConferenceUsers where tshirtsize
like 'Short Sleeve%'
select tshirtsize, 'L' from ConferenceUsers where tshirtsize
like 'Long Sleeve%'
select tshirtsize, 1 from ConferenceUsers where tshirtsize
like '%S'
select tshirtsize, 2 from ConferenceUsers where tshirtsize
like '%M'
select tshirtsize, 3 from ConferenceUsers where tshirtsize
like '%L'
select tshirtsize, 4 from ConferenceUsers where tshirtsize
like '%XL'
select tshirtsize, 5 from ConferenceUsers where tshirtsize
like '%2XL'
select tshirtsize, 6 from ConferenceUsers where tshirtsize
like '%3XL'
select tshirtcolor,'B' from ConferenceUsers where tshirtcolor
like '%Blue'
select tshirtcolor, 'G' from ConferenceUsers where tshirtcolor
like '%Green'
Thank you
Aaron
[Sleeve][Size][color]
[S|L] [1-6] [B|G]
where
tshirtsize = 'Short Sleeve M'
tshirtcolor = 'Stonewashed Blue'
result should be:
S2B
I would like to do this in sql.
Here is what I have so far.
How do I combine these statements to encode the data in the table.
select tshirtsize, 'S' as sleevecode from ConferenceUsers where tshirtsize
like 'Short Sleeve%'
select tshirtsize, 'L' from ConferenceUsers where tshirtsize
like 'Long Sleeve%'
select tshirtsize, 1 from ConferenceUsers where tshirtsize
like '%S'
select tshirtsize, 2 from ConferenceUsers where tshirtsize
like '%M'
select tshirtsize, 3 from ConferenceUsers where tshirtsize
like '%L'
select tshirtsize, 4 from ConferenceUsers where tshirtsize
like '%XL'
select tshirtsize, 5 from ConferenceUsers where tshirtsize
like '%2XL'
select tshirtsize, 6 from ConferenceUsers where tshirtsize
like '%3XL'
select tshirtcolor,'B' from ConferenceUsers where tshirtcolor
like '%Blue'
select tshirtcolor, 'G' from ConferenceUsers where tshirtcolor
like '%Green'
Thank you
Aaron