Viewing 15 posts - 4,501 through 4,515 (of 10,143 total)
SELECT
transactiondate = ISNULL(a.transactiondate,b.transactiondate),
a.TotalwebSales,
b.TotalInHouseSales
FROM (
select transactiondate, count(distinct transactionid) as TotalwebSales
from saletransactions
where transactionstationnumber = web -- ?
and transactiondate = <today> -- ?
group by transactiondate
) a
FULL OUTER JOIN (
select transactiondate,...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 13, 2013 at 9:54 am
jw.lankhaar (6/13/2013)
DECLARE @lowerbound int
DECLARE @increment int
DECLARE @upperbound int
SET @lowerbound = -5
SET @upperbound...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 13, 2013 at 9:02 am
.Netter (6/13/2013)
Im still confused on why negative numbers are used because from my eyes when u look at
WHEN Ordertype = 3 THEN -2
WHEN Ordertype = 1 THEN -1
if its 3...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 13, 2013 at 6:50 am
You're welcome - thanks for the feedback 🙂
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 13, 2013 at 6:34 am
select top(1) oh.OrderType
from OrderHandsets oh
where oh.OrderId = co.OrderId
ORDER BY CASE
WHEN Ordertype = 3 THEN -2
WHEN Ordertype = 1 THEN -1
ELSE oh.OrderType END
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 13, 2013 at 6:31 am
-- sample data
;WITH students (ID_Student, Name, rate) AS (
SELECT 1, CAST('Chipper Jones' AS nchar(30)), CAST('678*9' AS nchar(5)) UNION ALL
SELECT 2, 'Mike Piazaa', '98***' UNION ALL
SELECT 3, 'Barry Bonds', '678**' UNION...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 13, 2013 at 3:06 am
Amy.G (6/12/2013)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 13, 2013 at 1:05 am
ssurekha2000 (6/12/2013)
to get the result & check i prepared 3 different SPs with conditions as stated above
SP1 contains...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 13, 2013 at 1:00 am
Here's a pure tsql way which performs reasonably well:
SELECT *
FROM (
SELECT Postcode = 'BS16 1EJ' UNION ALL
SELECT 'OX8 1TP' UNION ALL
SELECT 'GL20 8LZ' UNION ALL
SELECT 'JUNK'
) d
CROSS APPLY (...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 9:38 am
SELECT
CYYMMDD,
SQLDate1 = CONVERT(DATE,STUFF(CYYMMDD,1,1,CASE WHEN LEFT(CYYMMDD,1) = '0' THEN '19' ELSE '20' END),112),
SQLDate2 = cast(cast(cast(CYYMMDD as int) + 19000000 as char(8)) as date),
SQLDate3 = CONVERT(DATE,CAST('1130531' + 19000000 AS CHAR(8)),112),
SQLDate4 =...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 9:22 am
SELECT
CYYMMDD,
SQLDateTime = CONVERT(DATETIME,STUFF(CYYMMDD,1,1,CASE WHEN LEFT(CYYMMDD,1) = '0' THEN '19' ELSE '20' END),112)
FROM (SELECT CYYMMDD = '1130531') t
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 8:37 am
Krishna1 (6/10/2013)
In procedure i am using Remark table to capture all the steps executed (instead of print). From another session when I try to
select * from...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 5:52 am
The table's two constraints cannot have the same name. Change one of them.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 5:05 am
Your query looks fine to me apart from the syntax errors. SQL Server is quite adept at optimising out query nesting.
SELECT
DistinctCompanyCount,
DenseGroup, CatName, CatId, CompanyId, CompanyName, PropertyId,
Status, Day,...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 5:02 am
@nitha jen
Please start a new thread for your issue. Hijacking other folks threads causes confusion. Thanks.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 4:32 am
Viewing 15 posts - 4,501 through 4,515 (of 10,143 total)