Viewing 15 posts - 5,341 through 5,355 (of 6,036 total)
It must be done on presentation level, not in database.
May 23, 2006 at 1:55 pm
Select your report resultset into temp table ( SELECT ... INTO #Table FROM ...) and LEFT JOIN this table to grouped select from itself.
SELECT A.*, B.bud-rent, COUNT(B.???)*100/COUNT(A.???) as bud-occ
FROM #Table...
May 23, 2006 at 5:42 am
SELECT T1.Broker
FROM (select Broker from loans
where close_date between <your range>
group by Broker) T1
LEFT JOIN (select Broker from loans
where close_date between <last 90 days>
group by Broker) T2 on...
May 22, 2006 at 4:03 pm
I would suggest to read a little about data normalisation.
It dramatically improves performance for ALL queries, not just this one.
May 22, 2006 at 3:43 pm
So, Ryan, you have used MAX() as well.
What's a difference?
You solution is just more complicated and more slow, but returns exactly the same result.
May 22, 2006 at 3:36 pm
What exactly does not work?
May 22, 2006 at 3:28 am
You must loop through those 2 millons rows.
That's why there is no memory usage and your CPU is very busy.
May 21, 2006 at 5:19 pm
You better create a view
CREATE VIEW CatSummary
AS
select CategoryID, count(*) as NbTot, sum(UnitsInStock) as NbUinS, sum(UnitsOnOrder) as NbUinO
from Products
GROUP BY CategoryID
and join this view to...
May 18, 2006 at 10:40 pm
SELECT SUM(NetSales * CASE WHEN Type = 0 THEN 1 ELSE - 1 END)
FROM dbo.Orders
WHERE (MONTH(InvoiceDate) = @MonthNo) AND (YEAR(InvoiceDate) = @YearNo)
GROUP BY MONTH(InvoiceDate), YEAR(InvoiceDate) --, Type - remove...
May 16, 2006 at 8:28 pm
Check out Output parameters in BOL.
May 16, 2006 at 8:06 pm
There must be dosen clues just in this forum for the last week.
Would you bother to browse forum first?
May 16, 2006 at 12:16 am
Remove all declarations -
declare @org_id int, @org_ver_id int, @last_updt_reg_id int
and do it set oriented.
update sa_entity
set last_updt_reg_id = dbo.function(i.org_id)
FROM inserted i
where sa_entity.org_id = i.org_id and sa_entity.org_ver_id =...
May 15, 2006 at 11:33 pm
Actually David's solution suppose to do exactly what you are asking for.
You must have modified it a little, so it now requires replies.
Return to the original query logic.
May 14, 2006 at 10:56 pm
Both are bad.
Put your values into temp table and join it to the tables from your query.
May 12, 2006 at 9:19 pm
2 Mauro
All you ToDo's must be done in UDF's. If you cannot predict its contents you may set a trigger on the table to recompile UDF related to updated or...
May 12, 2006 at 8:52 pm
Viewing 15 posts - 5,341 through 5,355 (of 6,036 total)