Viewing 15 posts - 3,976 through 3,990 (of 10,144 total)
Or this?
SELECT *
FROM document
WHERE (@dt = 1 AND doctype IN (1, 2))
OR (@dt = 0 AND doctype = 1)
September 12, 2013 at 9:28 am
What results do you get from this query?
;WITH Deleter AS (
SELECT
ID,
rn = ROW_NUMBER() OVER(ORDER BY Postcode,BuildingName,housenumber,SubBuilding,County,Town,
LocalName,PostOutCode,PostInCode,Throughname,Throughdesc,poboxno,BusinessName,locality)
FROM PostCodesAndAddressesBt
)
SELECT *
FROM Deleter
WHERE rn > 1
September 12, 2013 at 7:26 am
Can you post a few rows please Mick, showing some dupes?
September 12, 2013 at 7:19 am
mick burden (9/12/2013)
Hi everyone, I've a table with 15 fields with 70,000 rows of data. I now realise I need to make each record unique.
Easy.
I could have gone down...
September 12, 2013 at 6:42 am
phoenix_ (9/12/2013)
... Am I doing something wrong?..
Possibly. If the datetime you are constructing is the upper bound of a range, you will almost certainly find it easier to use the...
September 12, 2013 at 3:41 am
The CTE is nothing more than a macro, it will be substituted into the query and result in LEFT() in the join. There's no gain.
September 12, 2013 at 2:16 am
Your initialisation code fails with an error. Your expectations are incorrect.
I think this is what you are looking for:
CREATE TABLE #table1(c nvarchar(1));
CREATE TABLE #table2(c nvarchar(1));
INSERT INTO #table1 SELECT '1' UNION...
September 12, 2013 at 2:14 am
kapil_kk (9/11/2013)
Amit Raut (9/11/2013)
SELECT * FROM Table AINNER JOIN Table B
WHERE LEFT(A.UserName, 7) = B.ID -- RELEVANT FIELD FROM TABLE B
Its not a good practice to use functions like LEFT,...
September 12, 2013 at 1:28 am
Dwain C has a nice article covering usage, I've put a link in an earlier post in this thread.
Blimey. I've learned so much from your website over the years. Nice...
September 12, 2013 at 1:23 am
Erland Sommarskog (9/11/2013)
ChrisM@Work (9/4/2013)
Or CROSS APPLY VALUES
Somewhat odd to use CROSS APPLY here. The normal is CROSS JOIN. Of course since there is no correlation on the right side, the...
September 12, 2013 at 1:19 am
jaiswalabhishek22 (9/11/2013)
...Can anyone please tell me how can I get expected 1769894 count...
Begin with the query below. Uncomment a single table source at a time, and run through all of...
September 11, 2013 at 8:49 am
Charlottecb (9/11/2013)
Hi ChrisM,Many thanks for taking the time to do this - I'll try out your version to see how much quicker it performs.:-D
You're welcome. With no sample data to...
September 11, 2013 at 7:14 am
Charlottecb (9/11/2013)
Just ran EXEC sp_updatestats and the problem has gone away! 😀
Excellent!
You might get better performance from this query by preaggregating some of those tables feeding the three subqueries, something...
September 11, 2013 at 6:15 am
batgirl (9/11/2013)
Quick read - looks like it should return 2 rows.
Hmmm...are 2 rows = 2 results? Not really...it's 1 result.
Look again...looks like Steppenwolf will...
September 11, 2013 at 5:56 am
Viewing 15 posts - 3,976 through 3,990 (of 10,144 total)