[thelist] (SQL) Query with Multi FK's to the same lookup

Hassan Schroeder hassan at webtuitive.com
Fri May 14 15:27:25 CDT 2004


Tab Alleman wrote:
> Suppose you've got a table with some products that can be rated for
> various qualities, and you've got a lookup table that associates a
> description with the rating:
> 
> Products Table:
> Prod_ID	OverallRating	FeaturesRating	ValueRating	
> 1		3			1			5
> 2		4			4			4
> 3		4			2			5
> ...
> 
> Rating Table:
> Rating	Description
> 1		Poor
> 2		Fair
> 3		Average
> 4		Good
> 5		Excellent
> 
> 
> I'm trying to think of a way to return a recordset of each Prod_ID with
> the Description associated with each rating:

Frankly, if this were MySQL, at least, I'd redefine all the rating
columns to ENUM('Poor','Fair','Average','Good','Excellent'); you'd
use your existing numeric insert/update statements but would get a
string back on selects...

FWIW,
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




More information about the thelist mailing list