Here's your original query:
select pName,Price, (Price*Quantity) as SalesValues from saleslog where
BillDate='12-10-2010' and pGroup=15 group by pname, Quantity, Price;
Now you say you want it grouped by pName only. So let's do that.
select pName,Price, (Price*Quantity) as SalesValues from saleslog where
BillDate='12-10-2010' and pGroup=15 group by pname;
Now, of course, it is going to give an error. So we need to put some aggregation on the other columns. It makes sense to SUM the SalesValues column.
select pName,Price, SUM(Price*Quantity) as SalesValues from saleslog where
BillDate='12-10-2010' and pGroup=15 group by pname;
The Price column is still a problem, though. What aggregator makes sense for that? It just depends. You could do MAX, MIN, or AVERAGE, I guess. But really it needs to be either left out, or added back to the group-by. If it's added back to the group by, then you can no longer have a single row for each pName. If you do put an aggregator on Prince, then be sure to change the name of the column to reflect what it means.
/* Leave out the Price completely. (My favorite option.) */
select pName,SUM(Price*Quantity) as SalesValues from saleslog where
BillDate='12-10-2010' and pGroup=15 group by pname;
/* Group by Price. You now have multiple rows per pName. */
select pName,Price, SUM(Price*Quantity) as SalesValues from saleslog where
BillDate='12-10-2010' and pGroup=15 group by pname, Price;
/* Average the Price. (OK, but could lead to confusion.) */
select pName,AVG(Price) as AveragePrice, SUM(Price*Quantity) as SalesValues from saleslog where
BillDate='12-10-2010' and pGroup=15 group by pname;
/* Max Price. (Almost useless). */
select pName,MAX(Price) as MaximumPrice, SUM(Price*Quantity) as SalesValues from saleslog where
BillDate='12-10-2010' and pGroup=15 group by pname;
/* Min Price. (Almost useless). */
select pName,MIN(Price) as MinimumPrice, SUM(Price*Quantity) as SalesValues from saleslog where
BillDate='12-10-2010' and pGroup=15 group by pname;
I don't recommend aggregating Price, though, (especially MAX and MIN) since it will likely lead to confusion down the line when people try to use the value.