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 |
|
gorlock27
Starting Member
3 Posts |
Posted - 2011-02-24 : 16:13:33
|
| i need to show all the categories for each book. is there a command that allows you to display multiple categories(category_name)? CREATE VIEW book_category ASSELECT book_id, book_title, category_id, category_nameFROM category, book, book_categoryWHERE category.category_id = book_category.category_idAND book_category.book_id = book.book_idORDER BY book.book_id; |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-02-24 : 18:43:46
|
| Not sure what you mean. Your query will show all category_names that have a matching id in the book and book_category tablesJimCREATE VIEW book_category ASSELECT b.book_id, b.book_title, c.category_id, c.category_nameFROM book b INNER JOIN book_category bcat ONb.book_id = bc.book_idINNER JOIN category c ON c.category_id = bc.category_id ORDER BY b.book_id;Everyday I learn something that somebody else already knew |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-02-26 : 09:31:27
|
| probably you can show some sample data and explain what you want------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|