Viewing 15 posts - 3,016 through 3,030 (of 10,143 total)
Here are several suggestions -
--SELECT @From = COALESCE(@From, Min(QuotationDate)),
-- @To = COALESCE(@To , Max(QuotationDate))
--FROM dbo.Quotation;
--DECLARE @F_Loc DateTime = @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
August 22, 2014 at 2:29 am
Here's something I wrote some time ago (inspired by something Jack Corbett wrote years ago) which explains why you have two joins followed by two ON clauses:
The order of tables...
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
August 22, 2014 at 1:52 am
ScottPletcher (8/21/2014)
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
August 22, 2014 at 1:41 am
-------------------------------------------------------------------------
-- Your first query has lots of scope for simplification:
-------------------------------------------------------------------------
SELECT 0 AS SIRA
,TBLCARI.IND
,(
SELECT SUM(BORC - ALACAK)
FROM F0102D0001TBLCARIHAREKETLERI AS CARHAR
WHERE CARHAR.FIRMANO = TBLCARI.IND
) AS BAKIYE
,TCG.ISLEMIND
,TBLCARI.SOYADI
,TBLCARI.ADI
,TBLCARI.SOYADI + ' ' + TBLCARI.ADI AS...
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
August 21, 2014 at 9:34 am
Speaking of bronze-age development, this is one of the very few threads I can post to. Attempting to reply to other threads (which look kinda "flat") raises an error. In...
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
August 21, 2014 at 6:44 am
jrusso (8/20/2014)
I figured out a way to do it. Thank you
Does it look something like this?
SELECT
[AmountGiven] = ISNULL(SUM(a.AmountGiven), 0),
a.YearToDate,
a.EndDate
FROM ( -- a
SELECT
[AmountGiven] = MAX(x.[AmountGiven]),
[EndDate] = MAX(y.[EndDate]),
YearToDate...
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
August 21, 2014 at 2:21 am
You're welcome.
Try this:
DROP TABLE #TEMP
CREATE TABLE #TEMP (PlayerName varchar(20),DismissFormat varchar(20),StrickRate int,CreatedDate date)
INSERT INTO #TEMP VALUES ('ABC','Catch Out',100,'2014-01-12') --Date is in YYYY/MM/DD format
INSERT INTO #TEMP VALUES ('ABC','Hit Wicket',50,'2014-01-13')
INSERT INTO #TEMP VALUES...
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
August 20, 2014 at 6:35 am
Paul, if you wouldn't mind running through your sample script and correcting the errors which Steve kindly pointed out, I'll take a look later today.
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
August 20, 2014 at 1:45 am
TomThomson (8/19/2014)
...that my wife hid (or, in wife-ese, "tidied up") ...
Gaaah! Don't get me started. Every time I start work on a job in the extension, all my tools are...
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
August 20, 2014 at 1:43 am
J Livingston SQL (8/18/2014)
pwalter83 (8/18/2014)
sgmunson (8/18/2014)
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
August 18, 2014 at 10:28 am
It looks like you are trying to run through sys.tables or whatever and do something to each table encountered, although as Gail points out, it's bl00dy hard to tell 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
August 18, 2014 at 6:32 am
I know what you are attempting to do here and it wouldn't take long with access to your tables, however scripts for all of the tables along with sample data...
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
August 18, 2014 at 6:24 am
Hi Paul
Can you provide the following please?
CREATE TABLE for MG_COUNTRY with INSERTs to populate a few sample rows
Do you wish to include every row from this table in the report?...
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
August 18, 2014 at 3:07 am
SELECT
[Id Number],
[Family Name],
[Given Name],
Title,
[Timesheet Date] = MAX([Timesheet Date]),
[Start Date],
[End Date]
FROM YourVacationTable
WHERE [Start Date] <= @EndDate
AND [End Date] >= @StartDate
GROUP BY [Id Number],[Family Name],[Given Name],Title,[Start Date],[End Date]
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
August 15, 2014 at 7:03 am
Koen Verbeeck (8/15/2014)
GilaMonster (8/15/2014)
Eirikur Eiriksson (8/14/2014)
You can try out these methods as previously suggested
However OP said
I really don't like this temp table creation
So, no row number, no temp tables....
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
August 15, 2014 at 4:29 am
Viewing 15 posts - 3,016 through 3,030 (of 10,143 total)