hi, try this
SELECT SalesPerson, State, SUM(Cost) AS TotalSales
FROM Invoice I
WHERE SalesPerson IN (SELECT TOP 5 SalesPerson FROM Invoice WHERE State=I.State GROUP BY SalesPerson ORDER BY SUM(Cost) DESC)
GROUP BY SalesPerson, State
hi
Do you need the last 15 records ordered by TXCLIPS.ID2 DESC?
If so, then order it by ASC then get the top 15.
SELECT *
FROM
(
SELECT TOP 15 TXMASTERS.ID1, TXCLIPS.ID2, " " AS Persons, TXCLIPS.NName AS Name, TXCLIPS.Comments, TXCLIPS.Start AS [Time In], TXCLIPS.End AS [Time Out], TXCLIPS.ID1...
hi, this should do it.
SELECT
Transaction_ID
,SUM(CASE WHEN Tran_Breakdown_ID = 'Net' THEN Amount ELSE 0 END) AS Net
,SUM(CASE WHEN Tran_Breakdown_ID = 'Fee' THEN Amount ELSE 0 END) AS Fee
,SUM(CASE WHEN Tran_Breakdown_ID = 'Tax_IPT' THEN Amount ELSE 0 END) AS Tax_IPT...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.