473,511 Members | 12,087 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can you solve this SQL problem?

I have tried and failed <grin>, any help would be appreciated.

Here is my data:

ID, dtDate, Hours, PayType
==============
Joe, 3/23/06, 7, Regular
Joe, 3/23/06, 1, Regular
Joe, 3/23/06, 2, Overtime
Joe, 3/24/06, 4, Regular

What SQL to get this recordset?

ID, dtDate, Regular, Overtime
======================
Joe, 3/23/06, 8, 2
Joe, 3/24/06, 4, 0

Mar 23 '06 #1
2 1035
See if this will help.

TRANSFORM Sum(TableName.Hours) AS SumOfHours
SELECT TableName.ID, TableName.dtDate
FROM TableName
GROUP BY TableName.ID, TableName.dtDate
ORDER BY TableName.PayType DESC
PIVOT TableName.PayType;

--
Wayne Morgan
MS Access MVP
"SaltyBoat" <ha*****@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
I have tried and failed <grin>, any help would be appreciated.

Here is my data:

ID, dtDate, Hours, PayType
==============
Joe, 3/23/06, 7, Regular
Joe, 3/23/06, 1, Regular
Joe, 3/23/06, 2, Overtime
Joe, 3/24/06, 4, Regular

What SQL to get this recordset?

ID, dtDate, Regular, Overtime
======================
Joe, 3/23/06, 8, 2
Joe, 3/24/06, 4, 0

Mar 23 '06 #2
A crosstab query, of course! Thanks for the reminder!

Mar 23 '06 #3

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

Similar topics

1
12778
by: BVM | last post by:
Hi, All: I have this error. It seems execution time is too long. Actually the execution time is about 30 seconds(I tested in Query analyzer). How do I solve this problem? ...
1
5473
by: BVM | last post by:
Hi, All: I have this error. It seems execution time is too long. Actually the execution time is about 30 seconds(I tested in Query analyzer). How do I solve this problem? ...
27
2275
by: John Salerno | last post by:
Ok, here's a problem I've sort of assigned to myself for fun, but it's turning out to be quite a pain to wrap my mind around. It's from a puzzle game. It will help if you look at this image: ...
8
4792
by: vj | last post by:
Hi all, I want to solve the two equations u*tan(u)=w and u^2 + w^2=V^2, where V is a known constant, and u and w are the two unknowns to be determined. Please can someone suggest me how to...
1
2647
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. ...
0
7245
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7356
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,...
0
7427
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...
1
7085
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...
0
7512
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...
0
5671
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,...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.