Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I want to extract data from SQL with max (YEAR) and max(month) at raw level extraction..
what shud be qyery for that?
pls suggest
select * from table
where year(date) = (select max(year) from table)
or something similar
we need more details to answer that
A subquery like this is one way:
SELECT Year,
Month,
...
FROM dbo.Table1
WHERE Year = Select(Max(Year) FRO dbo.Table1)
Hi ioannis,
below suggested working fine
select * from table
where year(date) = (select max(year) from table)
but below desired query does not giving any output
select * from table
where year(date) = (select max(year) from table) and month(date) = (select max(Period) from table);
pls suggest..
Why not you try for incremental load logic for this.
Regards,
Anand
abhay singh wrote:
but below desired query does not giving any output
select * from table
where year(date) = (select max(year) from table) and month(date) = (select max(Period) from table);
pls suggest..
From This, Might you require this
Load * From Table
where Year = Max(Year) and Month = Max(Month);
Hi.
Most likely the format is different. Try using the to_date function to make them match.