"LMcLain" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
>   Yes, this is quite the noob question: I want to have one fields
> reference another table, how do I do that?
>   Here's what I am trying to do.  I have a bunch of fields(or columns)
> Item, UPC, Manufacturer, MSRP for example.  I want to be able to
> choose the Manufacturer from a different table's list of
> manufacturers and then have that field address that record.

Normally, you would have two tables: Manufacturers(ManufacturerId, 
Manufacturer, OtherInfoAboutManufacturer) and Items(Item, 
ManufacturerId, OtherInfoAboutItem). A record in Items refers to a 
record in Manufacturers simply by virtue of using the same value in 
ManufacturerId field.

Given this arrangement, you can get a list of items and their 
manufacturers like so:

select Item, Manufacturer
from Items join Manufacturers
    on (Items.ManufacturerId = Manufacturers.ManufacturerId);


With all due respect, I suggest you invest in a SQL textbook. This is 
very basic, it would be explained in chapter 1.

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to