dbTalk Databases Forums  

Access to Sql Query

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Access to Sql Query in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Arejan
 
Posts: n/a

Default Re: Access to Sql Query - 12-29-2009 , 07:54 AM






For the SQL query, you have put the Max() function inside the Case
statement
instead of putting it outside; hence your problem.

tried it but all the same

Reply With Quote
  #12  
Old   
Arejan
 
Posts: n/a

Default Re: Access to Sql Query - 12-29-2009 , 08:25 AM






may be i should use pivot ?

Reply With Quote
  #13  
Old   
Sylvain Lafontaine
 
Posts: n/a

Default Re: Access to Sql Query - 12-29-2009 , 04:06 PM



No, you must remove the NewTable.NewDate from the Group By but you can keep
the Year([NewTable].[NewDate])and the Month([NewTable].[NewDate]) in the
Group By.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)


"Arejan" <areejan2000 (AT) yahoo (DOT) com> wrote

Quote:
may be i should use pivot ?


Reply With Quote
  #14  
Old   
Arejan
 
Posts: n/a

Default Re: Access to Sql Query - 12-30-2009 , 11:51 AM



removing the NewTable.NewDate from the Group
Column 'NewTable.NewDate' is invalid in the select list because it is
not contained in either an aggregate function or the GROUP BY clause.

what would be the ideal query for row to column in sql 2000

Reply With Quote
  #15  
Old   
Sylvain Lafontaine
 
Posts: n/a

Default Re: Access to Sql Query - 12-30-2009 , 04:50 PM



Yes, it's invalid to remove it if you keep your current Select's list. If
you take a look, you have hidden its value inside a call to Max() in the
Access query:

Max(IIf([NewTable].[expid]
=100,Format([NewTable].[NewDate],'mm/dd/yyyy'),Null))

but you didn't do the same thing in your SQL query. Maybe there are other
errors as well, I didn't look.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site: http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)


"Arejan" <areejan2000 (AT) yahoo (DOT) com> wrote

Quote:
removing the NewTable.NewDate from the Group
Column 'NewTable.NewDate' is invalid in the select list because it is
not contained in either an aggregate function or the GROUP BY clause.

what would be the ideal query for row to column in sql 2000

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.