|
Posted by msg on 10/01/41 11:35
SELECT TOP 100 w.TimeDate AS [date], p.ProdCode, COUNT(w.BoxID) AS
cases, AVG(w.PrintedWeight / w.PkgsPerBox) AS avgtrayweight
FROM dbo.WIPSixtyDay w INNER JOIN
dbo.Products p ON w.PLUNo = p.PLUNo
WHERE (p.PrePack = 1) AND (w.PkgsPerBox > 0)
GROUP BY w.TimeDate, p.ProdCode
ORDER BY w.TimeDate
This is what I need to do...... sum these by the date(w.timedate) my
original I was converting it to a string, but then none of my date
queries would work....
Here is my original
SELECT TOP 100 CONVERT(varchar(10), w.TimeDate, 101) AS [date],
p.ProdCode, COUNT(w.BoxID) AS cases, AVG(w.PrintedWeight /
w.PkgsPerBox)
AS avgtrayweight
FROM dbo.WIPSixtyDay w INNER JOIN
dbo.Products p ON w.PLUNo = p.PLUNo
WHERE (p.PrePack = 1) AND (w.PkgsPerBox > 0)
GROUP BY CONVERT(varchar(10), w.TimeDate, 101), p.ProdCode
ORDER BY CONVERT(varchar(10), w.TimeDate, 101)
This is in a View....if that matters...
Navigation:
[Reply to this message]
|