Viewing 15 posts - 181 through 195 (of 1,438 total)
Try this
WITH CTE AS (
SELECT cust_Id,sDate,budget,
ROW_NUMBER() OVER(PARTITION BY cust_id ORDER BY sDate) -
ROW_NUMBER() OVER(PARTITION BY...
April 17, 2015 at 8:58 am
This should work for you
WITH CTE AS (
select *,
row_number()over (ORDER BY RECORD_ID) -
row_number()over (PARTITION BY EXTRAS...
April 17, 2015 at 2:47 am
Using Gianlucas setup
WITH Grouped AS (
SELECT EmpCode,[Time],InOut,
ROW_NUMBER() OVER(PARTITION BY EmpCode ORDER BY [Time]) -
ROW_NUMBER() OVER(PARTITION BY...
April 15, 2015 at 4:08 am
coalesceuk (3/12/2015)
Mark Thanks for the fix, which works with my example data.
I've been testing both solutions with my real-world data. Both take...
March 13, 2015 at 7:40 am
coalesceuk (3/11/2015)
March 12, 2015 at 5:29 am
SELECT
(SELECT CONVERT(CHAR(8),GETDATE(),112) AS "FileDate" FOR XML PATH('header'),TYPE),
(
... my previous query here...
) AS "body"
FOR XML PATH('Records'),TYPE;
As far as I know you have to add the encoding '<?xml version="1.0" encoding="UTF-8"?>' in manually...
March 11, 2015 at 4:43 am
coalesceuk (3/10/2015)
IF OBJECT_ID('tempdb.dbo.#EmployeeProject') IS NOT NULL DROP...
March 11, 2015 at 3:54 am
See if this helps
SELECT t1.continent_id,
t1.continent_Name,
t1.continent_surface_area,
(SELECT t2.country_id,
...
March 10, 2015 at 10:58 am
This works with your sample data
WITH StartsAndEnds(StartEnd,ProjectId) AS (
-- Start points which overlap the same number of meetings as projects
SELECT s.MeetingStart,s.ProjectId
...
March 10, 2015 at 3:55 am
Great question, got it wrong but definitely learned something new.
March 6, 2015 at 1:25 pm
Not clear what you're asking, but maybe this
select MRN,
max(case when Problem='Congestive Heart Failure' then 'x' else '' end) as 'CHF',
max(case when Problem='Chronic Obstructive Pulmonary Disease' then 'x' else '' end)...
March 4, 2015 at 6:51 am
Here's another (using Luis's setup)
WITH Results(SetId1,SetId2) AS (
SELECT a.SetId,b.SetId
FROM SetsItems a
INNER JOIN SetsItems b ON b.SetId > a.SetId
...
February 25, 2015 at 3:12 pm
I suspect you'll need to use some sort of running total on the Duration column. Search for "quirky update" for a very fast method, there's plenty of good folks out...
February 25, 2015 at 11:16 am
Are you using SQL Server 2012? If so you can do this
select Item,
Sequence,
StartTime,
...
February 25, 2015 at 10:05 am
SELECT COALESCE(s1.Name,s2.Name,s3.Name) AS name,
s1.val1,
s2.val2,
s3.val3
FROM @sample1-2 s1
FULL OUTER...
February 25, 2015 at 8:39 am
Viewing 15 posts - 181 through 195 (of 1,438 total)