473,566 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Convert Access Transform/Pivot Query for SQL Server

I have posted this on a couple of Access and SQL Server newsgroups, but with
no answer yet. There seems to be very little activity on the ones I have
looked at, so I thought I would post here as well, since I have no doubt
that many people here also use Access/SQL Server. Anyway, enough of my
rambling and on with the problem/question.

I have two queries that I use in Access:

<qrySelect>
SELECT table2.column1, table2.column2, table2.column3, table1.column4 FROM
table1, table2 WHERE table1.column1 = table2.column1
</qrySelect>

<qryResult>
TRANSFORM First(qrySelect .column3) AS FirstOfCode
SELECT qrySelect.colum n1, qrySelect.colum n4, First(qrySelect .column3) AS
[Total Of Code] FROM qrySelect GROUP BY qrySelect.colum n1, qrySelect.colum n4
PIVOT qrySelect.colum n2
</qryResult>

I now wish to use them against a SQL Server database but I am unfamiliar
with the equivalent construct of Transform/Pivot in SQL Server. I read in
the MS documentation that I should use ROLLUP on the GROUP BY clause, but
try as I might I cannot make it work.

Can any one suggest how this might be done?

If there is a better newsgroup to post this question in I would be grateful
if someone could point me in the right direction.

TIA

Charles Law

Jul 21 '05 #1
5 9918


Jul 21 '05 #2
Hi Charles,

I have checked which is the major SQL newsgroup and saw you had not placed
this message there.

It is not less smaller than the framework.aspne t newsgroup

Maybe you have a change there,

microsoft.publi c.sqlserver.pro gramming

Cor
Jul 21 '05 #3
Thanks Cor. I will try my luck there as well.

Charles
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Hi Charles,

I have checked which is the major SQL newsgroup and saw you had not placed
this message there.

It is not less smaller than the framework.aspne t newsgroup

Maybe you have a change there,

microsoft.publi c.sqlserver.pro gramming

Cor

Jul 21 '05 #4
http://www.sqlteam.com/item.asp?ItemID=2955

Do you know this link, is from Google.

Cor
Jul 21 '05 #5
Thanks Cor. That looks like a good solution. I will try it. I had searched
Google but didn't turn this one up. I can't have been looking for the right
thing :-)

Cheers.

Charles
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:Og******** ******@TK2MSFTN GP09.phx.gbl...
http://www.sqlteam.com/item.asp?ItemID=2955

Do you know this link, is from Google.

Cor

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2850
by: Alan Lane | last post by:
Hello world: I'm including both code and examples of query output. I appologize if that makes this message longer than it should be. Anyway, I need to change the query below into a pivot table query. I'm having trouble doing it. Help! Here is my code so far: Sub OldRegionQuery()
2
1649
by: suya | last post by:
Hi, can anyone help me how to do this query from a table in MS Access. Table name: A date | fclass | trx_type | trx_amount 5/2 1 a 57.02 5/2 1 b 60.35 5/3 5 t 41.50 5/4 2 p 49.60 5/5 9 c 55.90 I need...
6
3916
by: Jean | last post by:
Hi, I am using an Access 2000 front-end to an Oracle 9 backend. I want to write a query that returns all records that are not older than one year for Column "Status_30" (which is a Date). When I look at the ODBC Datasource in Table DWHADMIN_V_PROBLEM , the Date formatting looks normal to me, like #05/07/2005#. However, when I try using...
5
1615
by: Charles Law | last post by:
I have posted this on a couple of Access and SQL Server newsgroups, but with no answer yet. There seems to be very little activity on the ones I have looked at, so I thought I would post here as well, since I have no doubt that many people here also use Access/SQL Server. Anyway, enough of my rambling and on with the problem/question. I...
9
101424
by: dotnetguru | last post by:
Hi SMART GUYS, Please help me write a query. Actually I want to convert my rows into columns. Can anyone kindly give me the query to do it? My rows are about employees. There can be any number of employees (in the following table I have 3 employees ABC, EFG, WRI) with any number of records for each employee (there can be 20, 30 records each),...
3
6024
by: Nassa | last post by:
Hi everyone, I have 3 tables: Telbook(Id:int,Name:char,address:char,comment:ntext,owneruserid:int), PK:id TelNumbers(telbookid:int,telno:char,telNotype:int,syscode:int),PK:syscode,F­K:telNumbers.telbookid=telbook.id Teltypes(teltypes:char,fk:int),FK:telnumbers.telnotype=teltypes.fk
2
1488
by: Radu | last post by:
Hi. I have an 'Attendance' table like this: PIN Year Category Days 1 2006 Authorized 1 1 2006 Available 2 1 2006 Personal 3 2 2006 Authorized 4 2 2006 Available 5 2 2006 Personal 6 3 2006 Authorized 7
0
7650
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some syntax elements you must supply. The description of these elements will be in the contained in the angle brackets. Square brackets are used to show...
18
4503
by: smckibbe01 | last post by:
I have Pivot Table query in MS Access that I would like to run in SQL Server 2005. Can anyone help me to convert the syntax over to SQL Server. The following is the query in MS Access: TRANSFORM SUM(ps.psScheduled) SELECT pi.piMaxTurns, pi.piAMP, pi.piTons, '', '', ps.psPipe
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7951
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.