SQL How To
If one of my fields in a database is a sequence like {1,2,5} and those numbers
are references to unique IDs in another table, how would I get a field from
the other table using those reference IDs (that is, what's the SQL)?
For instance
person table (1 record):
unique_id:1
name:cklester
fruits:{1,2,5}
fruits table (5 records):
unique_id:1
name:apple
unique_id:2
name:orange
unique_id:3
name:pear
unique_id:4
name:banana
unique_id:5
name:kiwi
So my query would return {"apple","orange","kiwi"}
Should I do away with the sequence field and create a new table like so:
prefs table (3 records):
unique_id:1
person:1
fruit_pref:1
unique_id:2
person:1
fruit_pref:2
unique_id:3
person:1
fruit_pref:3
Thanks!
-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/
|
Not Categorized, Please Help
|
|