Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I get the followng error: Msg 8120, Level 16, State 1, Line 93 Column 'buyer.buyerID' is invalid in the select list because it isnot contained

I get the followng error:

Msg 8120, Level 16, State 1, Line 93
Column 'buyer.buyerID' is invalid in the select list because it isnot contained in either an aggregate function or the GROUP BYclause.

for this query:

SELECT buyerID, buyerName FROM buyer AS a
INNER JOIN buyerItem AS b ON buyer_ID = buyerID
GROUP BY buyer_ID ORDER BY COUNT(item_ID) DESC SET ROWCOUNT1;

WHAT IM TRYING TO DO The most activebuyer (the one who has bought the most number of items)

MY tables:

create table buyer

(
buyerID INT IDENTITY(1000,1) NOT NULL,
buyerName varchar(20) NOTNULL,
buyerUsername varchar(20)UNIQUE NOT NULL,
buyerPassowrd varchar(32) NOT NULL,

contact_ID int,
creditCardID int,

primary key(buyerID),

Foreign Key(contact_ID) referencescontactInfo(contactID),
Foreign Key(creditCardID) referencescreditCardInfo(credit_CardID));

create table buyerItem
(
buyer_ID int NOT NULL,
item_ID int NOTNULL,

PRIMARY KEY(buyer_ID,item_ID),

FOREIGN KEY (buyer_ID) REFERENCESbuyer(buyerID),
FOREIGN KEY (item_ID) REFERENCES item(itemID));

LET ME KNOW IF YOU NEED MORE INFORMATION

Step by Step Solution

3.42 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

When you run a GROUP BY query and have at least one column in the select list that is n... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Calculate the missing quantities four-figure accuracy.

Answered: 1 week ago

Question

Calculate the missing quantities four-figure accuracy.

Answered: 1 week ago