Viewing 15 posts - 6,436 through 6,450 (of 10,144 total)
Slightly tested:
SELECT aYr, bYr, aCol, bCol
FROM #A a
CROSS APPLY (
SELECT MAX_bYr = MAX(bYr) FROM #b) x
INNER JOIN #b b
ON b.bYr = CASE WHEN a.aYr <= MAX_bYr THEN a.aYr ELSE...
December 1, 2011 at 5:22 am
Usman Butt (12/1/2011)
ChrisM@Work (12/1/2011)
SELECT
ItemCode,
Column1 = MAX(CASE WHEN YearShipped = 2010...
December 1, 2011 at 3:38 am
Use a crosstab, preaggregating the raw table with either a CTE or a derived table. Here's the derived table version:
SELECT
ItemCode,
Column1 = MAX(CASE WHEN YearShipped = 2010 AND MonthShipped =...
December 1, 2011 at 2:43 am
Denise McMillan (11/30/2011)
select number, avalue, (select x.nvalue from valuestbl as...
November 30, 2011 at 10:26 am
Hey Jon, thanks loads for posting up sample data - it took a moment to tweak the script but no worries. Try this:
;WITH CTE AS (
SELECT
ID,
ProjectID,
rowDescription,
[Year],...
November 30, 2011 at 7:54 am
Hi Jon, welcome to the forum.
Can you post up some sample data? There's a link in my sig which shows how to do this - well worth a read for...
November 30, 2011 at 6:57 am
alaguganesha1983 (11/30/2011)
T-SQL , Stored Procedures & Performance Tuning:I need clear idea and good example for the above topic i mentioned.
help me with this please.
Acquiring sufficient experience, knowledge and understanding of...
November 30, 2011 at 2:31 am
ashkan siroos (11/29/2011)
I have Changed my query to avoid cross apply because of the efficiency ...
CROSS/OUTER APPLY can be surprisingly efficient - read the excellent articles written by Paul White,...
November 30, 2011 at 2:09 am
FROM
.
.
.
CROSS APPLY (
SELECT poi.POIDescription, rn = ROW_NUMBER() OVER(ORDER BY r.RequestCode desc)
FROM DMSRequestDocListTbl rdl
INNER JOIN DMSRequestTbl r
ON rdl.RequestCode = r.RequestCode
AND r.RequestTypeID in ( 8,9)
AND r.DocRevID = @DocRevID...
November 29, 2011 at 10:02 am
Try using Cross/Outer Apply.
You can easily convert the content into an inline TVF.
November 29, 2011 at 6:45 am
Using a temp table containing the PK's of the target table looks like the best option to me:
SELECT sec_no
INTO #sec_no_to_delete
FROM sec_returns m
WHERE NOT EXISTS (
SELECT 1
FROM sec_returns
WHERE...
November 29, 2011 at 3:59 am
Evil Kraig F (11/22/2011)
SQLRNNR (11/22/2011)
riddleQuestion Mark
Mark is innocent!
November 29, 2011 at 3:25 am
Jorge Lopes (11/28/2011)
SELECT 'Balanço[space][space]ANO'
CREATE TABLE #desc
( NAME VARCHAR(100))
INSERT INTO #desc
SELECT...
November 28, 2011 at 10:30 am
DROP TABLE #desc
CREATE TABLE #desc
( NAME VARCHAR(100))
INSERT INTO #desc
SELECT 'Balanço- Activo não corrente' UNION ALL -- note changed position of hyphen
SELECT 'Balanço - Autonomia Financeira' UNION ALL
SELECT 'Balanço ANO'
SELECT
NAME,...
November 28, 2011 at 4:01 am
Character position 9 of two of your strings is a hyphen. There are ways to get around this, for instance you could remove the hyphen and a white space using...
November 28, 2011 at 3:53 am
Viewing 15 posts - 6,436 through 6,450 (of 10,144 total)