473,893 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Counting rows part II

14 New Member
I have the following query:
1. SELECT products.name, COUNT(reviews.r eview)
2. FROM (select distinct name from products) products
3. FULL JOIN reviews ON products.name = reviews.product name
4. GROUP BY products.name
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.name products.altnam e
ProdA prd_a
ProdA proda
ProdB prb
ProdB prodb

...and the review table:
reviews.prodnam e 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
3 1196
8,127 Recognized Expert Expert
Is it such that for the same products.name you have different products.altnam e ?
Apr 14 '08 #2
14 New Member
Is it such that for the same products.name you have different products.altnam e ?
Yes, that is correct.

Apr 14 '08 #3
2,878 Recognized Expert Specialist
You might want to reconsider re-designing your tables and their relationship.

-- CK
Apr 14 '08 #4

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

Similar topics

by: walexand | last post by:
I use the database mysql v.4. My problem is... I have a select like: select * from user where language = "de"; the result are then: id name =================== 1 max
by: Viswanatha Thalakola | last post by:
Hello, Can someone point me to getting the total number of inserts and updates on a table over a period of time? I just want to measure the insert and update activity on the tables. Thanks. - Vish
by: Tony Johansson | last post by:
Hello Experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that I don't understand completely. It says "A garbarage collector, such as the one used in Java, maintains a record of whether or not an object is currentlys being used. An unused object is tagged as garbage,
by: Megan | last post by:
hi everybody- i'm having a counting problem i hope you guys and gals could give me some help with. i have a query that retrieves a bevy of information from several different tables. first let me give you a little background. this database is kind of like a human resources database. it collects info about people, where they work, and if they have any work-related issues where they work.
by: Peter | last post by:
Hi, This post is about counting rows and finding the max count in a group of rows. I'm trying to find the player who scored the most goals in a game. I know how to find out how many goals the players scored, but I do not know how to find the player who scored the most goals in a specific game. The tables:
by: ChadDiesel | last post by:
I appreciate the help on this group. I know I've posted a lot here the last couple of weeks, but I was thrown into a database project at my work with very little Access experience. No other employee knows anything about Access. I've searched Google Groups, and that has been a lot of help, but there are some questions that I just can't find the answer to. I'll try to take it easy on the group after this question. I have one more...
by: jai | last post by:
i have a list of suppliers, each supplies one part for each order so i have a long list of suppliers most of with are duplicated. how do i count the number of orders the supplier has and use this number to calculate the average number of days late which i have already worked out, do i have ot use SQL??
by: Chia Lee Lee | last post by:
Hello… I have problem when counting the number of records, which is based on the start date and end date. I have tried to use message box to prompt the result, but the result given is zero(0).Actually there have records in database which fulfill the “WHERE” clause condition in sql statement. Thanks for yours help… Carol, /* Below is my code sample(VB.NET) */ sDate = dtStart.Value.ToShortDateString eDate = dtEnd.Value.ToShortDateString
by: PlimoMan | last post by:
Im helping a friend with a little access and we're both stuck on this one part. Hes using a query to create a report and he wanted to add a total of certain rows in teh header or footer. We know how to use the =Count(*) in the textbox to get the total rows returned form the Query,but is there a way to filter them? He has a feild that is called Status and would contain either the word "Allocated" or "Unallocated". He would like to count how...
by: nickels | last post by:
Well im writing a program in java and my program had to do with Sudoku but its only 4 by 4 not 9 by 9. My program checks to see weather the rows, columns, and regions add up to 10. The output would look like this... Enter Row 1: 3 2 4 1 Enter Row 2: 4 1 3 2 Enter Row 3: 1 4 2 3 Enter Row 4: 2 3 1 4 REG-1:GOOD REG-2:GOOD REG-3:GOOD
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.