Viewing 15 posts - 6,631 through 6,645 (of 8,731 total)
I'm grumpy today, but something made me help you more. Usually, on a day like this, I would have asked you to post DDL and sample data in a consumable...
April 1, 2014 at 1:31 pm
I would unpivot[/url] the source table, join it with the metadata table, use cross tabs[/url] to obtain the desired result and run away from that horrible design.
That destination table looks...
April 1, 2014 at 12:30 pm
demin99 (4/1/2014)
I tried to use Stuff and XMLpath but it is not giving me distinct results.
Have you tried nesting them?
April 1, 2014 at 12:15 pm
SQLRNNR (4/1/2014)
Ed Wagner (4/1/2014)
Lynn Pettis (4/1/2014)
jasona.work (4/1/2014)
...OK, old man rant off (crap, 44 is just 3.5 weeks away!)
You're not old!
Personally, I really hope you're not old at 44. 😉
Personally I...
April 1, 2014 at 10:22 am
You were really close to the solution.
WITH CTE1
as
(
SELECT r.GradeId,
r.DateofMfg,
ROW_NUMBER() OVER (order by r.DateofMfg)
- ROW_NUMBER() OVER (Partition by r.GradeId order by r.DateofMfg) as GroupID
FROM @t r...
April 1, 2014 at 10:12 am
the.roof (3/31/2014)
Luis Cazares (3/27/2014)
March 31, 2014 at 2:23 pm
marsidbomba (3/31/2014)
What if the data is March 2014, February 2014,January 2014, December 2013, November 2013 ... April 2013. Would you be able to sort that?
Only if you cast them as...
March 31, 2014 at 2:11 pm
You could use the syslanguages view along with the DelimitedSplit8K[/url] and Crosstabs[/url].
SELECT
MAX( CASE WHEN name = 'us_english' THEN s.Item END ) English
,MAX( CASE WHEN name = 'Deutsch' THEN s.Item...
March 31, 2014 at 1:54 pm
You need to have the complete date value to order the months correctly or you could have another value to order by.
Examples:
DECLARE @Date date;
SET @Date = '20140405'
SELECT LEFT( DATENAME( MM,...
March 31, 2014 at 1:40 pm
The code is still there. It's just located at the end instead of the beginning.
I'm glad that you're helping. I'm just trying to pay it forward. 😉
March 31, 2014 at 10:56 am
Eirikur Eiriksson (3/31/2014)
Luis Cazares (3/31/2014)
WITH Contacts AS(
SELECT INS.INSPNO, CNT.FIRSTNAME, CNT.LASTNAME, CNT.CAPACITY,
ROW_NUMBER() OVER( PARTITION BY INS.INSPNO ORDER BY CASE WHEN Capacity = 'Contractor' THEN -1 ELSE INS.INSPNO...
March 31, 2014 at 10:54 am
Here are 2 other options.
WITH Contacts AS(
SELECT INS.INSPNO, CNT.FIRSTNAME, CNT.LASTNAME, CNT.CAPACITY,
ROW_NUMBER() OVER( PARTITION BY INS.INSPNO ORDER BY CASE WHEN Capacity = 'Contractor' THEN -1 ELSE INS.INSPNO END DESC) rn
FROM @inspection...
March 31, 2014 at 7:57 am
It seems almost fine, but it's weird. You're not summing up the values. I added the SUM() and converted it to a iTVF. You need to test it as well...
March 31, 2014 at 7:45 am
Viewing 15 posts - 6,631 through 6,645 (of 8,731 total)