cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lowdmt
Helper II
Helper II

Power Automate Desktop - SQL query for Excel

Hi,

 

This is Power Automate Desktop.

 

I'm building a SQL query to grab some data from a large Excel file but I'm struggling with the syntax to filter the data by date. 

 

The query below works as expected and returns my records

 

SELECT [CSS_DB_Exch], [Exchange Name], [Contractor Number], [Supplier], [Company Name], [Estimate Number and Source], [Actual Work End], [Combined Status], [Programme], [Partner_Man_ORG]
FROM [Latest Data$]
WHERE ([Company Name] LIKE ('%%Civ%%') OR [Company Name] LIKE ('%%Cv%%')) AND ([Combined Status] IN ('X')

 

When I add and additional filter to the column [Actual Work End] I return zero results.

 

SELECT [CSS_DB_Exch], [Exchange Name], [Contractor Number], [Supplier], [Company Name], [Estimate Number and Source], [Actual Work End], [Combined Status], [Programme], [Partner_Man_ORG]
FROM [Latest Data$]
WHERE ([Company Name] LIKE ('%%Civ%%') OR [Company Name] LIKE ('%%Cv%%')) AND ([Combined Status] IN ('X')
AND [Actual Work End] BETWEEN #01/04/2022# AND #10/10/2022#)

 

 

I've tried multiple different ways to write the date filter

 

[Actual Work End] = '17/06/2022' - No results

[Actual Work End] > '17/06/2022' - Brings back all results

[Actual Work End] > #17/06/2022# - Brings back all results

[Actual Work End] BETWEEN #17/06/2022# AND #27/06/2022# - No results

[Actual Work End] BETWEEN #01/04/2022# AND #08/10/2022# - No results

[Actual Work End] BETWEEN #04/01/2022# AND #10/08/2022# - No results

[Actual Work End] BETWEEN '04/01/2022' AND '10/08/2022' - No results

 

The Excel column is formatted as a Date column

lowdmt_0-1665397489349.png

 

Any help appreciated

0 REPLIES 0

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (6,278)