By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

Counting rows part II

P: 14
I have the following query:
2. FROM (select distinct name from products) products
3. FULL JOIN reviews ON = reviews.productname
which lists product names and the number of reviews for each product. I need to include one more column from the products table in the table resulting from the above query. This column (called altname) can have different values for a certain product (each product can appear multiple times in the table). It doesn't matter which of the altname values for a product that is presented in the resulting table as long as someone is. Is this possible? See example below.
The products table: products.altname
ProdA prd_a
ProdA proda
ProdB prb
ProdB prodb

...and the review table:
reviews.prodname review
ProdA bla bla....
ProdA bla bla....
ProdB bla bla....

should result in:
name altname reviews_count
ProdA prd_a 2
ProdB prb 1

Apr 14 '08 #1
Share this Question
Share on Google+
3 Replies

Expert 5K+
P: 8,127
Is it such that for the same you have different products.altname ?
Apr 14 '08 #2

P: 14
Is it such that for the same you have different products.altname ?
Yes, that is correct.

Apr 14 '08 #3

Expert 2.5K+
P: 2,878
You might want to reconsider re-designing your tables and their relationship.

-- CK
Apr 14 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.