Select most rectent record type query

RSXchin

Well-known Member
Joined
Oct 23, 2010
Messages
758
I was given (by the wonderful people on this board) a query that unfortunatly won't work for me because it crashes excel (no access, I wish. but no)

Here is the query that was given to me after I changed the field names
PHP:
SELECT OutputColumnC,TransTimestamp
FROM (Select OutputColumnC,TransTimestamp,
(select Count(TransTimestamp) 
from (Select Distinct OutputColumnC,TransTimestamp from HistoryTable) as L1 
where L1.TransTimestamp>=L2.TransTimestamp and L1.OutputColumnC=L2.OutputColumnC 
and DeviceName='In') as Rank from HistoryTable as L2) as Tab1
WHERE Rank= 1

I'm looking for a way that base query only looks at Today's records. I'm thinking that might make it not crash so much.

Thanks again to Littleiitn and Norie.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I just realized I didn't even say what I wanted from this query...

I have 3 fields.
DeviceName: Returns what happened. Ex: "Classroom In"
TransTimestamp: when the activity in DeviceName happened (each instance is a new record)
OutputColumnC: Employee name

I want to find out the last DeviceName instance for every employee for today. If doing multi-tiered queries, the base MUST be only Today, otherwise Excel, in it's 2003-ishness, will crash.
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,626
Members
452,933
Latest member
patv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top