Viewing 15 posts - 706 through 720 (of 1,229 total)
CTE's work kinda like a view-on-the-fly and SQL Server sometimes balks at the complexity of the resolved query. Chained CTE's are particularly bad, and also those containing UNION as opposed...
December 30, 2011 at 1:01 pm
VIG (12/30/2011)
...It was my mistake...
Not necessarily - it could still be interpretation. The same three missed payments are captured by two different event rows. The correct solution could be one...
December 30, 2011 at 12:26 pm
VIG (12/30/2011)
ChrisM@home (12/30/2011)
Hey VIG, this one's right up your street, been expecting you.Our results differ, I get two positive rows, you get one:
Why ???
ClaCaseIDNameIDIncidentDateMissed
37430 ...
December 30, 2011 at 11:42 am
Hey VIG, this one's right up your street, been expecting you.
Our results differ, I get two positive rows, you get one:
ClaCaseIDNameIDIncidentDateMissed
43703754542008-09-01N
132459640852009-02-20N
285845806272009-08-02Y
374305806272009-11-11Y
417279640852009-12-11N
2063089640852011-03-31N
December 30, 2011 at 10:47 am
andy.julson (12/29/2011)
FROM dbo_HomePhone hp, dbo_Subscription sub, dbo_Address_G1 ad, dbo_PhoneDelivery pd
LEFT OUTER JOIN dbo_PersonPhone pp
ON hp.PhoneID = pp.PhoneID
WHERE hp.PhoneID = pd.PhoneID and
pd.AddressID = ad.AddressID and
hp.PhoneID...
December 30, 2011 at 8:13 am
Jeff Moden (12/30/2011)
malleswarareddy_m (12/30/2011)
Hi,with cte this code will work fine.
with cte as
(select 1 as i
union all
select i+1 from cte where i<5
)
select 'ABC'+CAST(i as varchar) from cte
Please read the following article...
December 30, 2011 at 6:46 am
Alter the sample data slightly so that there are 3 non-consecutive rows with PaymentStatus = 9 for ReceiverID = 964085:
INSERT INTO #AccPayments VALUES
(4,375454,'2008-05-17'), (4,375454,'2008-05-19'), (4,375454,'2008-06-04'), (4,375454,'2008-06-30'), (4,375454,'2008-07-28'), (4,375454,'2008-08-28'),
(4,375454,'2008-09-29'), (4,375454,'2008-10-13'),...
December 30, 2011 at 6:36 am
INSERT INTO #Result VALUES (4370,375454,375454,'2008-09-01','N')
INSERT INTO #Result VALUES (13245,964085,964085,'2009-02-20','N')
INSERT INTO #Result VALUES (28584,580627,580627,'2009-08-02','Y')
INSERT INTO #Result VALUES (37430,580627,580627,'2009-11-11','N') -- incorrect
INSERT INTO #Result VALUES (41727,964085,964085,'2009-12-11','N')
INSERT INTO #Result VALUES (206308,964085,964085,'2011-03-31','N')
Select * from #Result
;WITH...
December 30, 2011 at 3:18 am
Post some sample data and the expected result - for more information about how best to ask a question, please read the link in my sig.
December 30, 2011 at 2:39 am
vaithi.saran846 (12/29/2011)
what is the main advantage of view.? How view will help in performance. consider i have the some complex select query and i am running that...
December 30, 2011 at 2:19 am
mic.con87 (12/29/2011)
Sorry another thing is that ClaCaseID is unique but a NameID can have multiple ClaCaseID's:w00t:
Post an extended sample data set which yields the incorrect results you are getting from...
December 30, 2011 at 2:10 am
pdharmaraju (12/29/2011)
December 30, 2011 at 2:02 am
Can you post the code for the function?
December 30, 2011 at 1:59 am
;WITH OrderedData AS (
SELECT
a.*, c.ClaCaseID,
c.IncidentDate,
rn = ROW_NUMBER() OVER(PARTITION BY a.ReceiverID ORDER BY a.DueDate)
FROM #AccPayments a
INNER JOIN #ClaCases c ON c.ReceiverID = a.ReceiverID
WHERE a.DueDate >= DATEADD(month,-6,c.IncidentDate)
) SELECT
o1.ClaCaseID,...
December 29, 2011 at 11:15 am
GROUP BY won't give you what you're looking for - it's the aggregate operator. ORDER BY gives you TOP. However, unless you have a suitably-constructed rollup table or view, you...
December 26, 2011 at 4:07 am
Viewing 15 posts - 706 through 720 (of 1,229 total)