Viewing 15 posts - 2,251 through 2,265 (of 8,731 total)
Sergiy (8/24/2016)
I don't have it handy, but it...
August 24, 2016 at 8:20 pm
I mean that instead of the proposed solution:
SELECT DISTINCT
ID,
Brand = STUFF(( SELECT ',' + Brand
...
August 24, 2016 at 12:27 pm
GilaMonster (8/24/2016)
Luis Cazares (8/24/2016)
Also, using DISTINCT is expensive. In this case, you should try using GROUP BY.
Which will behave exactly the same as the DISTINCT. Since he wants distinct values,...
August 24, 2016 at 12:07 pm
Let's see if I understand correctly.
You want to change the value of a column to track changes on the table? Are your queries prepared to handle soft deletes? If you...
August 24, 2016 at 11:58 am
chozhanvijay 23273 (8/24/2016)
I think i should use the STUFF instead of the coalesce here. As coalesce is for returning the non null values. Can you please help me out...
August 24, 2016 at 11:53 am
Why do you think that you need coalesce? What do you think coalesce does? If you're not sure, read the following link: https://msdn.microsoft.com/en-us/library/ms190349.aspx
To solve your problem, you might want to...
August 24, 2016 at 11:05 am
You can use Cross tabs.
SELECT Region, District, LocID,
MAX(CASE WHEN Title = 'IT Director' THEN Cnt ELSE 0 END),
MAX(CASE WHEN Title = 'IT Manager' THEN Cnt ELSE 0 END)
--etc
FROM...
August 24, 2016 at 9:53 am
JALLYKAMOZE (8/24/2016)
Thanks Sir,This worked perfectly
Great! Do you understand why and how it works?
August 24, 2016 at 8:07 am
Here's another option. Note that these solutions won't eliminate tabs, line feeds or other spacing characters. I created a function to avoid making the query too complex and to reuse...
August 24, 2016 at 7:56 am
If you want to create the table with a column named as the first occurrence, you need to use dynamic sql. That's just wanting problems, IMHO.
Otherwise, you could do this:
IF...
August 23, 2016 at 4:20 pm
JALLYKAMOZE (8/23/2016)
Luis Cazares (8/23/2016)
SELECT CASE WHEN Monday = 1 THEN 'Monday'
WHEN Tuesday =...
August 23, 2016 at 2:16 pm
You can use a CASE expression for this:
SELECT CASE WHEN Monday = 1 THEN 'Monday'
WHEN Tuesday = 1 THEN 'Tuesday'
---etc
...
August 23, 2016 at 2:08 pm
tstagliano (8/23/2016)
August 23, 2016 at 2:05 pm
JALLYKAMOZE (8/23/2016)
THESE TABLES HAVE VALUES BETWEEN 0 AND 1 EG,
MONDAY : 0, TUESDAY :1,WEDNESDAY : 0,THURSDAY:1,FRIDAY:1. SATURDAY:1 SUNDAY:1
HOW CAN I SELECT ONLY...
August 23, 2016 at 2:02 pm
August 23, 2016 at 1:57 pm
Viewing 15 posts - 2,251 through 2,265 (of 8,731 total)