Select error:Server: Msg 8120, Level 16, State 1, Line 1 
Author Message
 Select error:Server: Msg 8120, Level 16, State 1, Line 1
Howdy

I get this error
Server: Msg 8120, Level 16, State 1, Line 1
Column 'T2.mountain' is invalid in the select list because it is not
contained in either an aggregate function or the GROUP BY clause.
when I run this query is:
select   T1.TOWN,  ( T2.mountain + T1.country + T1.river) as
Datastring1
sum(T3.theaters)
from  Database1..TABLE1 T1 ,Dat2..TABLE2 SM, Database1..TABLE3 T3
 where
T1.CENTER = T2.CENTER
AND T1.TOWN = T3.TOWN
GROUP BY T1.TOWN

Thanks for your help

AL



Wed, 22 Sep 2004 05:47:32 GMT
 Select error:Server: Msg 8120, Level 16, State 1, Line 1

You don't tell us what you're trying to do.

If you post examples of your data, and what you're actually trying to do,
then people can help you.

If not, we're just guessing.

With the statement you've listed, a GROUP BY statement doesn't make sense.


Quote:
> Howdy

> I get this error
> Server: Msg 8120, Level 16, State 1, Line 1
> Column 'T2.mountain' is invalid in the select list because it is not
> contained in either an aggregate function or the GROUP BY clause.
> when I run this query is:
> select   T1.TOWN,  ( T2.mountain + T1.country + T1.river) as
> Datastring1
> sum(T3.theaters)
> from  Database1..TABLE1 T1 ,Dat2..TABLE2 SM, Database1..TABLE3 T3
>  where
> T1.CENTER = T2.CENTER
> AND T1.TOWN = T3.TOWN
> GROUP BY T1.TOWN

> Thanks for your help

> AL



Wed, 22 Sep 2004 18:47:49 GMT
 Select error:Server: Msg 8120, Level 16, State 1, Line 1
select   T1.TOWN, ( T2.mountain + T1.country + T1.river) as
Datastring1
T3.theaters
from Database1..TABLE1 T1 ,Dat2..TABLE2 SM, Database1..TABLE3 T3
where
T1.CENTER = T2.CENTER
AND T1.TOWN = T3.TOWN
whith the above query here is what I get:

DENVER,MountAuburnUSARiver1,10
DENVER,MountAuburnUSARiver1,15
PARIS,MountIDAFRANCERiviere1,100
BOSTON,MountCreekUSARiver11,2
BOSTON,MountCreekUSARiver11,10
BARCELONA,MountFidelSpainRiveraUno,10

here is what I want to get
DENVER,MountAuburnUSARiver1,25
PARIS,MountIDAFRANCERiviere1,100
BOSTON,MountCreekUSARiver11,12
BARCELONA,MountFidelSpainRiveraUno,10
if town and datastring1 on a record are the same then I want the total of theaters.
Thanks
AL

Quote:

> You don't tell us what you're trying to do.

> If you post examples of your data, and what you're actually trying to do,
> then people can help you.

> If not, we're just guessing.

> With the statement you've listed, a GROUP BY statement doesn't make sense.



> > Howdy

> > I get this error
> > Server: Msg 8120, Level 16, State 1, Line 1
> > Column 'T2.mountain' is invalid in the select list because it is not
> > contained in either an aggregate function or the GROUP BY clause.
> > when I run this query is:
> > select   T1.TOWN,  ( T2.mountain + T1.country + T1.river) as
> > Datastring1
> > sum(T3.theaters)
> > from  Database1..TABLE1 T1 ,Dat2..TABLE2 SM, Database1..TABLE3 T3
> >  where
> > T1.CENTER = T2.CENTER
> > AND T1.TOWN = T3.TOWN
> > GROUP BY T1.TOWN

> > Thanks for your help

> > AL



Thu, 23 Sep 2004 01:27:52 GMT
 Select error:Server: Msg 8120, Level 16, State 1, Line 1
AL,

Your select statement has a couple of syntax problems, so I don't
think you got those results from it.

Here is an example of what you are trying to do using the
Northwind..Orders table.

If you need more help, please post simplified (tested) DDL (CREATE
TABLE statements), sample data in the form of INSERT statements and
the desired ouput.

Linda

Quote:
> select   T1.TOWN, ( T2.mountain + T1.country + T1.river) as
> Datastring1
> T3.theaters
> from Database1..TABLE1 T1 ,Dat2..TABLE2 SM, Database1..TABLE3 T3
> where
> T1.CENTER = T2.CENTER
> AND T1.TOWN = T3.TOWN
> whith the above query here is what I get:

> DENVER,MountAuburnUSARiver1,10
> DENVER,MountAuburnUSARiver1,15
> PARIS,MountIDAFRANCERiviere1,100
> BOSTON,MountCreekUSARiver11,2
> BOSTON,MountCreekUSARiver11,10
> BARCELONA,MountFidelSpainRiveraUno,10

> here is what I want to get
> DENVER,MountAuburnUSARiver1,25
> PARIS,MountIDAFRANCERiviere1,100
> BOSTON,MountCreekUSARiver11,12
> BARCELONA,MountFidelSpainRiveraUno,10
> if town and datastring1 on a record are the same then I want the
> total of theaters. Thanks
> AL



> > You don't tell us what you're trying to do.

> > If you post examples of your data, and what you're actually
> > trying to do, then people can help you.

> > If not, we're just guessing.

> > With the statement you've listed, a GROUP BY statement doesn't
> > make sense.



> > > Howdy

> > > I get this error
> > > Server: Msg 8120, Level 16, State 1, Line 1
> > > Column 'T2.mountain' is invalid in the select list because it
> > > is not contained in either an aggregate function or the GROUP
> > > BY clause. when I run this query is:
> > > select   T1.TOWN,  ( T2.mountain + T1.country + T1.river) as
> > > Datastring1
> > > sum(T3.theaters)
> > > from  Database1..TABLE1 T1 ,Dat2..TABLE2 SM, Database1..TABLE3
> > > T3  where
> > > T1.CENTER = T2.CENTER
> > > AND T1.TOWN = T3.TOWN
> > > GROUP BY T1.TOWN

> > > Thanks for your help

> > > AL



Thu, 23 Sep 2004 03:02:05 GMT
 Select error:Server: Msg 8120, Level 16, State 1, Line 1
Sorry. Forgot to post the code. :(

select ShipCity, ShipName + ShipCountry, sum(Freight)
from   Northwind..Orders
group by ShipCity, ShipName + ShipCountry
order by ShipCity, ShipName + ShipCountry

Quote:
> Your select statement has a couple of syntax problems, so I don't
> think you got those results from it.

> Here is an example of what you are trying to do using the
> Northwind..Orders table.

> If you need more help, please post simplified (tested) DDL (CREATE
> TABLE statements), sample data in the form of INSERT statements and
> the desired ouput.

> Linda

> > select   T1.TOWN, ( T2.mountain + T1.country + T1.river) as
> > Datastring1
> > T3.theaters
> > from Database1..TABLE1 T1 ,Dat2..TABLE2 SM, Database1..TABLE3 T3
> > where
> > T1.CENTER = T2.CENTER
> > AND T1.TOWN = T3.TOWN
> > whith the above query here is what I get:

> > DENVER,MountAuburnUSARiver1,10
> > DENVER,MountAuburnUSARiver1,15
> > PARIS,MountIDAFRANCERiviere1,100
> > BOSTON,MountCreekUSARiver11,2
> > BOSTON,MountCreekUSARiver11,10
> > BARCELONA,MountFidelSpainRiveraUno,10

> > here is what I want to get
> > DENVER,MountAuburnUSARiver1,25
> > PARIS,MountIDAFRANCERiviere1,100
> > BOSTON,MountCreekUSARiver11,12
> > BARCELONA,MountFidelSpainRiveraUno,10
> > if town and datastring1 on a record are the same then I want the
> > total of theaters. Thanks
> > AL



> > > You don't tell us what you're trying to do.

> > > If you post examples of your data, and what you're actually
> > > trying to do, then people can help you.

> > > If not, we're just guessing.

> > > With the statement you've listed, a GROUP BY statement doesn't
> > > make sense.



> > > > Howdy

> > > > I get this error
> > > > Server: Msg 8120, Level 16, State 1, Line 1
> > > > Column 'T2.mountain' is invalid in the select list because it
> > > > is not contained in either an aggregate function or the GROUP
> > > > BY clause. when I run this query is:
> > > > select   T1.TOWN,  ( T2.mountain + T1.country + T1.river) as
> > > > Datastring1
> > > > sum(T3.theaters)
> > > > from  Database1..TABLE1 T1 ,Dat2..TABLE2 SM, Database1..TABLE3
> > > > T3  where
> > > > T1.CENTER = T2.CENTER
> > > > AND T1.TOWN = T3.TOWN
> > > > GROUP BY T1.TOWN

> > > > Thanks for your help

> > > > AL



Thu, 23 Sep 2004 03:40:53 GMT
 
 [ 5 post ] 

 Relevant Pages 

1. Server: Msg 7399, Level 16, State 1, Line 1 error on .mdb as linked server

2. Server: Msg 7399, Level 16, State 1, Line 1 error on .mdb as linked server

3. Newbie query problem - Msg 8120, level 16 etc...

4. Help.Error: Msg 7399, Level 16, State 1, Line 1

5. Server: Msg 7391, Level 16, State 1, Line 4

6. Server: Msg 7354, Level 16, State 1, Line 1

7. Server: Msg 547, Level 16, State 1, Line 6

8. Server: Msg 18757, Level 16, State 1, Procedure sp_repldone, Line 333 The databa

9. Server: Msg 4321, Level 16, State 1, Line 2

10. Server: Msg 1813, Level 16, State 2, Line 1

11. Server: Msg 1776, Level 16, State 1, Line 1

12. Unable to use sp_AddRole = Server: Msg 8114, Level 16, State 4, Procedure sp_addrole, Line 0


 
Powered by phpBB® Forum Software