Viewing 9 posts - 16 through 25 (of 25 total)
SELECT p.PeopleID, p.ProfileID
FROM Profiles p JOIN
(SELECT PeopleID, MAX(Updated) LastUpdated
FROM Profiles
GROUP BY PeopleID) x ON p.PeopleID = x.PeopleID AND p.Updated = x.LastUpdated
November 20, 2007 at 9:29 am
November 17, 2007 at 1:52 pm
SELECT g.MarketingGroup, SUM(s.DailySales) [Year-To-Date],
SUM(CASE WHEN s.Day >= '20070201' AND s.Day < '20070301' THEN s.DailySales END) [Month-To-Date]
FROM dbo.Sales s JOIN
(SELECT 'Kiwi' ProduceItem, 'FRUIT' MarketingGroup
UNION ALL SELECT 'Apricot', 'FRUIT'
UNION ALL...
November 17, 2007 at 1:29 pm
SELECT s.#District, s.StoreId #Store, SUM(i.InvoiceAmount) Total#Invoices, SUM(i.ItemsSold) TotalItems,
CONVERT(char(7),i.InvoiceDate,120) YearMonth --, CONVERT(char(8),STUFF(InvoiceDate,4,3,''),101) MonthYear
FROM #Store s JOIN #Invoices i ON s.StoreId = i.StoreId
GROUP BY CONVERT(char(7),i.InvoiceDate,120), s.#District, s.StoreId--, CONVERT(char(8),STUFF(InvoiceDate,4,3,''),101)
Problem with your MonthYear format...
November 15, 2007 at 3:57 am
declare @starttime varchar(10), @stoptime int
set @starttime = '16:30'
set @stoptime = 1249
select duration = @stoptime - datediff(n,0,@starttime)
November 14, 2007 at 7:52 am
select left(c1,patindex('%[^0-9]%',c1)-1)
from test
November 14, 2007 at 7:35 am
CONVERT(char(5),@dt,120)+RIGHT('0'+DATENAME(ww,@dt),2)
March 24, 2004 at 5:10 am
select stuff(convert(char(22),round(cast(800.00070474058253 as float),6),2),11,7,'')
March 23, 2004 at 5:23 am
Could just read "Deferred Name Resolution and Recompilation" in BOL.
There is problem with instantiating local variable as here. If table has more then 1 row, value may be unexpected.
March 12, 2004 at 5:11 pm
Viewing 9 posts - 16 through 25 (of 25 total)