Wednesday

sql:select one row on join

        

SELECT *
FROM AccountTransactions AS inv
INNER JOIN [Accounts basic] a2 ON inv.AccountId = a2.ID
JOIN ( SELECT *
FROM ( SELECT *,
ROW_NUMBER() OVER ( PARTITION BY AccountTransactionId ORDER BY ProcessDate ) AS RowId
FROM dbo.BillingTransactions
) Tmp
WHERE RowId = 1
) b ON inv.TransactionId = b.AccountTransactionId

more...

No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...