Viewing 15 posts - 346 through 360 (of 3,957 total)
PSB (2/16/2015)
Thanks . Works perfectly.
Just so you know and before someone else chides me on this point, you should read this link and decide if any of those cases applies...
February 16, 2015 at 5:47 pm
pbo71465 (2/16/2015)
I have a table of Customers & their data in about 20 Columns.
I have another table that has potential Customers with 3 Columns.
I want to append the records from...
February 16, 2015 at 5:25 pm
Do you mean like this?
WITH ProductIDs AS
(
SELECT OrdID, ProjID, ProductID=1
,Blocks=MAX(Blocks), PAmount=MAX(Pamount), Punits=MAX(PUnits)
FROM #Temp
...
February 16, 2015 at 5:20 pm
sm_iransoftware (2/16/2015)
I Have 3 Tables
Please Help me to Get This Result :
ProductId - ProductConfigId (With Min Price) -MinPrice - HasGift
1 > ...
February 16, 2015 at 4:56 pm
SQL_Padwaan (2/16/2015)
Not sure what you meant ...
Actually I think David got it. But if his solution isn't what you seek, try also posting expected results for the sample data...
February 16, 2015 at 4:51 pm
ChrisM@Work (2/16/2015)
rodjkidd (2/16/2015)
Hey Chris,How likely is the chance now of you turning up Thursday at SQL Bits?
Rodders...
I've booked the day off, mate - need 5 minutes to book the thursday...
February 16, 2015 at 4:41 pm
SQL_Padwaan (2/12/2015)
I have been stuck with this query for a while now and not sure how to go on about this as reached a brick wall.
I have two...
February 15, 2015 at 5:03 pm
Another way that might work for you, depending on what columns you need out of #MachineBranch:
SELECT a.MachineFK, b.*
FROM
(
SELECT MachineFK
FROM #MachineBranch
...
February 15, 2015 at 5:00 pm
This has the cheapest cost according to the Execution Plan but that doesn't always mean it's faster:
WITH IntervalDates AS
(
SELECT mind=MIN(DateStart), maxd=MAX(DateEnd)
FROM #OverlappingIntervals
),
...
February 12, 2015 at 7:25 pm
Here's another way that I'm a little happier with:
WITH IntervalDates AS
(
SELECT mind=MIN(DateStart), maxd=MAX(DateEnd)
FROM #OverlappingIntervals
),
Calendar (d) AS
(
...
February 12, 2015 at 7:17 pm
Given that explanation, this seems to work.
select OrderID, [status], DateStart, DateEnd
INTO #OverlappingIntervals
FROM
(VALUES
(1, 'A',convert(datetime,'20150101'),convert(datetime,'20150331')),
(2, 'B','20150115','20150215'),
(3, 'C','20150215','20150315'),
(4, 'D','20150115','20150315'),
(5, 'E','20150401','20150415')
) AS TimeIntervals(OrderId, status, DateStart, DateEnd);
select OrderID, [status], DateStart, DateEnd
FROM...
February 12, 2015 at 6:38 pm
patrickmcginnis59 10839 (2/10/2015)
...You get your best speed out of T-SQL if you make sure each programming statement works on as many rows as possible...
I would say "that depends." But...
February 11, 2015 at 6:27 pm
pietlinden (2/11/2015)
Look at Jeff Moden's DelimitedSplit8K function. It basically converts a delimited string to a table that you could use in a join.
Or instead use a Table Valued Parameter:...
February 11, 2015 at 6:23 pm
In the TOP 2 or 3 or 4 you are listing (outside of the Others group), what do you want to do if there are ties?
This looks to me like...
February 11, 2015 at 6:21 pm
rhythmk (2/11/2015)
BWFC (2/11/2015)
Have you got a calendar table? That will make the calculation of working days much easier.Can you please give me a link.
Look at Calendar Tables in T-SQL[/url]
There's...
February 11, 2015 at 5:53 pm
Viewing 15 posts - 346 through 360 (of 3,957 total)