怎樣在已知月的基礎上查上月的記錄,是不是這樣的
SELECT *, CAST(CAST(sum1 / sum2 * 100 AS decimal(10, 2)) AS varchar(10))
+ '% ' AS sum12
FROM (SELECT *
FROM (SELECT SUM(subqty) AS sum1
FROM dbo.suboqa
WHERE checkdate > = @starttime AND
checkdate <= @endtime AND resultd = 1) a JOIN
(SELECT SUM(subqty) AS sum2
&