tanj1035
asked on
SQL, add where clause
If I want to add "where tblreportingtransactions.T ransaction Date <'2017-03-01" in the query below, where it should be? Thank you.
select loanid, openprincipalbalance
from (
select openprincipalbalance, row_number() over(partition by loanid order by transactiontype_flag, transactiondate DESC) as row_num
from tblReportingTransactions
cross apply (
select case when [transactiontypid] in (1,2,3,11,23) then 0 else 1 end as transactiontype_flag
) as ca1
) as rpt
where row_num = 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you, Scott
ASKER
Thank you for your reply, Agx. I tried it out, unfortunately, it did not work. Thanks.
@tanj1035 - No worries, my syntax was wrong :)
( Beaten by Scott Pletcher and his darned CROSS APPLY .. again! ;-)
( Beaten by Scott Pletcher and his darned CROSS APPLY .. again! ;-)
Open in new window