I've just started learning SQL in order to manipulate my databases, but the gargantuan nature of the following problem has obscured my ability to think striaght, so that I don't really have any clear idea about what kind of query I need to write in order to solve it!
I have 2 tables;
- sts-catalogue, which is a catalogue of products. It has fields as follows;
Product Number
Product Name
Price
Short Description
Category 1
Category 2
Category 3
Picture
Add to Cart Link
Thumbnail.
- ratings-review, which is a database of user ratings and reviews for those products. Its fields are;
Product Number
Rating
Rating Link
Star Rating
Comments
I want to join/merge these two tables. However there are a couple of complications;
- Not every product listed in sts-catalogue has a corresponding record in ratings-review (although all records in ratings-review are present in sts-catalogue).
- With the table ratings-review, there are many occurences of more than one user review for a single product, so that the same Product Number and Rating Link appears in several records, even though the Rating,Star Rating and Comments fields for each record is different.
Because I want to produce web pages individual products, which will include all the reviews for a particular product appearing on the same page, I'm going to need to have individual records which will include a field for each series of ratings.
Thus my final joined table format will need to look something like this:
Product Number
Product Name
Price
Short Description
Category 1
Category
Category 3
Picture
Add to Cart Link
Thumbnail
Rating Link
Rating1
Star Rating1
Comments1
Rating2
Star Rating2
Comments2
Rating3
Star Rating3
Comments3(...and so on)
It might appear that I'm simply getting someone to do my dirty work for me here, but I'm not being lazy - I tend to take solutions and play with them in different situations, which expands my ability to think for myself, so any help offered will be greatly appreciated.