Viewing 15 posts - 9,256 through 9,270 (of 10,143 total)
Have a look at the ClientID dupes in the bargains table. Are they really different clients, or do they differ in spelling, or missing country code?
Is this a one-off process,...
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
December 5, 2008 at 8:13 am
Did you try this:
DECLARE @Boston_prdID (numeric)
SET @Boston_prdID = 555
SELECT p.*, c.*, d.DistanceToBoston AS [MinDistanceToBoston]
FROM PRODUCTS p
INNER JOIN OTM o ON o.prdID = p.prdID
INNER JOIN CITIES c ON c.postcodeID =...
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
December 5, 2008 at 7:50 am
SELECT @lX = lambertX, @lY = lambertY FROM CITIES WHERE postcodeID = @localID
The definition fior the cities table doesn't include lambertX and lambertY
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
December 5, 2008 at 7:47 am
SELECT *
FROM dbo.Bargains
WHERE CAST(ClientID AS NVARCHAR (10)) IN (
SELECT CAST(b.ClientID AS NVARCHAR (10)) AS ClientID
FROM dbo.Bargains b
WHERE NOT EXISTS (SELECT 1 FROM dbo.tblClients c WHERE c.ClientID COLLATE...
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
December 5, 2008 at 7:41 am
-- Set org_id to be same org_id as manager:
UPDATE p SET org_id = m.org_id
FROM Person p
INNER JOIN Person m ON m.emp_id = p.mgr_id
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
December 5, 2008 at 7:31 am
Thanks...this tells us that none of the rows in the bargains table have a match in the clients table according to the matching methods we've tried.
Time to retry the INSERT...
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
December 5, 2008 at 7:19 am
A Little Help Please (12/5/2008)
Sorry to be Stupid, but what do you mean by"just 4 numbers"?
Nah, me stupid not you, sorry.
SELECT COUNT(*)
FROM dbo.Bargains b
--GROUP BY b.Client, b.CountryCode, CAST(b.ClientID 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
December 5, 2008 at 7:02 am
I'm afraid your second query has a problem as well.
Now I get results where all postcodeID's are used for all products
That's the intention, sometimes a quick eyeball is all...
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
December 5, 2008 at 6:58 am
Hi Chris
There's an error in the JOIN, which is corrected here:
DECLARE @Boston_prdID (numeric)
SET @Boston_prdID = 555
SELECT p.*, c.*, dbo.getDistanceFromID(@Boston_prdID, c.latitude, c.longitude) AS [DistanceToBoston], d.DistanceToBoston AS [MinDistanceToBoston]
FROM PRODUCTS p
INNER JOIN...
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
December 5, 2008 at 6:34 am
A Little Help Please (12/5/2008)
I have now attched the...
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
December 5, 2008 at 6:06 am
A Little Help Please (12/5/2008)
I have now attched the...
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
December 5, 2008 at 6:05 am
Yep your absolutely right, this type of query is far more elegant in 2005.
Here's a query which will work.
[font="Courier New"]DECLARE @Boston_prdID (numeric)
SET @Boston_prdID = 555
SELECT p.*, c.*
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
December 5, 2008 at 5:48 am
chris (12/5/2008)
Chris Morris (12/5/2008)
Say your reference city is Boston, your requirement would be:
For each and every individual product (which has been sold), list the nearest city to...
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
December 5, 2008 at 5:34 am
Ok lets confirm this:
Say your reference city is Boston, your requirement would be:
For each and every individual product (which has been sold), list the nearest city to Boston where it's...
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
December 5, 2008 at 5:26 am
Chris,
Do you mean this:
retrieve unique products (prdID) AND the city it's in (postcodeID) AND the shortest distance to a reference city
Cheers
ChrisM
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
December 5, 2008 at 5:15 am
Viewing 15 posts - 9,256 through 9,270 (of 10,143 total)