Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

TRANSFORM query for MS Access using .NET

Posted on 2010-11-25
3
Medium Priority
?
277 Views
Last Modified: 2012-05-10
Below I can't do the first query but can do the second query. The queries are the same, creating a make table query on the result of another query, but the second query has a TRANSFORM and PIVOT part while the first doesn't. So, I don't know much abou that type of query... except that it didn't work... what's the reason for that? (I mean, both simply produce a table as a result... so I don't know why I can't call that table 'Temp' and then SELECT INTO a new table called RevenueByCountryAct.

CAN'T do this query

strSQL = "SELECT Temp.* INTO RevenueByCountryAct FROM"
strSQL = strSQL + " (TRANSFORM Sum([Table1].BillAmount) AS SumOfBillAmount"
strSQL = strSQL + " SELECT [Table1].FILESOURCE, [Table1].TYPE, [Table1].[Product Code], [Table1].Service, [Table1].Service2, [Table1].Service3, [Table1].COUNTRY"
strSQL = strSQL + " FROM [Table1]"
strSQL = strSQL + " GROUP BY [Table1].FILESOURCE, [Table1].TYPE, [Table1].[Product Code], [Table1].Service, [Table1].Service2, [Table1].Service3, [Table1].COUNTRY"
strSQL = strSQL + " PIVOT [Table1].[Billing Period]) AS Temp"

Open in new window


CAN do this query

strSQL = "SELECT Temp.* INTO RevenueByCountryAct FROM"
strSQL = strSQL + " (SELECT [Table1].FILESOURCE, [Table1].TYPE, [Table1].[Product Code], [Table1].Service, [Table1].Service2, [Table1].Service3, [Table1].COUNTRY"
strSQL = strSQL + " FROM [Table1]"
strSQL = strSQL + " GROUP BY [Table1].FILESOURCE, [Table1].TYPE, [Table1].[Product Code], [Table1].Service, [Table1].Service2, [Table1].Service3, [Table1].COUNTRY"
strSQL = strSQL + ") AS Temp"

Open in new window

0
Comment
Question by:AidenA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 2000 total points
ID: 34213594
That is not possible with Access syntax.
What you can do is store the TRANSFORM query by name, then follow up with another
select * into newtable from QueryWithTransform
0
 
LVL 44

Expert Comment

by:GRayL
ID: 34214861
Pres Alt+F11, Microsoft Visual Basic Help, Microsoft Jet Reference, Data Manipulation Language, SQL Subqueries - this is of interest:

Some subqueries are allowed in crosstab queries — specifically, as predicates (those in the WHERE clause). Subqueries as output (those in the SELECT list) are not allowed in crosstab queries.



0
 

Author Comment

by:AidenA
ID: 34218119
thanks cyberkiwi, followed your suggestion and it worked fine. Not the way I'd prefer to do it, but it shouldn't be a problem at the same time so I'll go ahead with that.

Thanks, Aiden
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question