Viewing 15 posts - 511 through 525 (of 1,347 total)
Distinct only works on the entire row, regardless of where you place parentheses.
Your issue is cardinality of data. The fact that you have a table named T_ContactTypeContact indicates that a...
March 6, 2006 at 2:29 pm
Here's an example of the impact, using temp tables, and just 10,000 rows. You can imagine what this scales to in your 800K sample. A SQL server data page is...
March 3, 2006 at 1:37 pm
>>Why should a "long" column in the select list make this query so slow ?
Because a long nchar column drastically reduces the number of rows per data page, increases considerably...
March 3, 2006 at 12:33 pm
Tested and working:
Select ListName
FROM #tblParent As p
Inner Join
(
Select ParentID, Count(Distinct CategoryCode) As CountAB
From #tblChild
WHERE CategoryCode in ('A','B')
Group By ParentID
) dt
On p.ID = dt.ParentID
Where...
March 3, 2006 at 9:17 am
Select t1.ID, t1.Value,
(Select Sum(t2.Value) From YourTable As t2
Where t2.ID = t1.ID And t2.Identity <= t1.Identity
) As Summed
From YourTable As t1
March 3, 2006 at 9:12 am
Is there a 3rd column available in the original 2 column set that supplies the order in which the rows occur ?
March 3, 2006 at 8:51 am
Update P
Set
price = O.price
From Products As P
Inner Join Products_Options As OP
On (OP.ProductID = P.ProductID)
Inner Join Options As O
On (O.OptionID = OP.OptionID And
O.ProductID = OP.ProductID)
March 2, 2006 at 2:20 pm
>>1. What will the drawbacks of having no Clustered index on a table? (for both static & transactional table)
Table fragmentation. Maintenance utilities like DBCC DBREINDEX() will not be able to...
March 2, 2006 at 9:59 am
DECLARE @y INT
SELECT @y = COUNT(*) FROM Customers
March 2, 2006 at 9:55 am
>>PW: is there any need for the following...
>>dt.MaxCreatedPerGroup = tbl1.DateCreated
It doesn't work without that. The purpose of the derived table is to find the most recent date per GroupID....
March 2, 2006 at 9:41 am
That "simple" query is too simple:
group by groupID, groupValue
You can't group on GroupValue, if the requirement is to eliminate all but 1 of the GroupValues for each...
March 2, 2006 at 9:12 am
Join to a derived table that gives you Max(Date) per group to join to:
select tbl1.groupID, tbl1.groupValue, tbl1.dateCreated
from tbl1
Inner Join
(
Select GroupID, Max(DateCreated) As MaxCreatedPerGroup
From tbl1
Group By GroupID
) dt
...
March 2, 2006 at 8:47 am
Use derived tables instead of sub-queries
Use joins instead of IN() for improved efficiency
Use a UNION ALL for mutually exclusive resultsets, instead of an OR condition
select distinct customer_id
from orders As...
March 1, 2006 at 2:06 pm
A DBCC DBREINDEX would probably be useful. If the tables that are pulled in are essentially readonly for reporting purposes, you could DBREINDEX with a 100% fillfactor, which would reduce...
March 1, 2006 at 10:56 am
Syntax error in my delete code.
DELETE ar
FROM @tblARData As ar
WHERE EXISTS (
SELECT *
FROM @tblARDataTemp As t
WHERE t.Site = ar.Site
)
February 28, 2006 at 2:09 pm
Viewing 15 posts - 511 through 525 (of 1,347 total)