guswebb
asked on
SQL view return results for coded values
I have coded values in table A and table B however I need to view these easily in a view called MyView, as per below. There are millions of rows in table A and table B so I have trimmed this down significantly as per below snapshot.
table A
ValueID field value
1 type Compact
2 type Convertible
3 type Estate
4 type Less than 1 year old
5 age 1 - 2 years old
6 age 2 - 3 years old
7 age 3 - 4 years old
8 age 4 - 5 years old
table B
userID type age
251846 1 5
251847 3 8
MyView
UserID Type Age
251846 Compact 1 - 2 years old
251847 Estate 4 - 5 years old
table A
ValueID field value
1 type Compact
2 type Convertible
3 type Estate
4 type Less than 1 year old
5 age 1 - 2 years old
6 age 2 - 3 years old
7 age 3 - 4 years old
8 age 4 - 5 years old
table B
userID type age
251846 1 5
251847 3 8
MyView
UserID Type Age
251846 Compact 1 - 2 years old
251847 Estate 4 - 5 years old
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the grade. Good luck with your project. -Jim
btw, in Table A, are the ValueID numbers unique?
btw, in Table A, are the ValueID numbers unique?
If yes, then you can lose the '... and a.field='something' part, especially if field is not part of an index, which would mean the query would do a slower scan instead of a seek.
If no, then you'll need it.
ASKER
ValueID is an autoid field. I will give the code a try without that element in place, thanks.
ASKER