Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
see199
Starting Member
21 Posts |
Posted - 2007-07-08 : 23:09:49
|
i'm doing this in asp.net 2003i dunno if is ok to post at here, i'm blur with how the database works.here's the question, is it possible to use other table data to use as another table's data? i mean a multiple value. for examples:car(plate_no, model, items)item(id, name, cost)car(AA 3333, hyundai, *)car(CA 2323, kia, *)item(1, wings, $300)item(2, bumper, $200)item(3, blue_tints, $100)car AA3333 uses the item 1,2 & 3 in the column called items while car CA2323 uses the item 1&2 in the column called items.do i modify those database thing in sql or asp? |
|
cas_o
Posting Yak Master
154 Posts |
Posted - 2007-07-09 : 05:05:06
|
I would use a linking table. So there would be three tables:Car(plate_no, model)Item(itemid, item, cost)CarItem(plate_no, itemid)With data like this:Car(AA 3333, hyundai)Car(CA 2323, kia)Item(1, wings, $300)Item(2, bumper, $200)Item(3, blue_tints, $100)CarItem(AA 3333, 1)CarItem(AA 3333, 2)CarItem(AA 3333, 3)CarItem(CA 2323, 1)CarItem(CA 2323, 2)SELECT Car.plate_no, Car.model, Item.item, Item.cost FROM Car JOIN CarItem on Car.plate_no = CarItem.plate_no JOIN Item on CarItem.itemid = Item.itemid ORDER BY Car.plate_no;-]... Quack Waddle |
|
|
|
|
|
|
|