Viewing 15 posts - 6,466 through 6,480 (of 8,731 total)
You really love to overcomplicate things.
Even worse, I can force the order of execution with derived tables. I materialize one of the joins, thus
((T1
INNER JOIN
T2
ON T1.a = T2.a)
AS X
T3
ON X.a...
May 14, 2014 at 5:01 pm
That's the beauty of relational databases, you don't need to store the repeated values. You just need to use the joins wisely.
CREATE TABLE #Employees(
emp__id char(3),
...
May 14, 2014 at 4:50 pm
npatel 17252 (5/14/2014)
What I want to do is add a column that has 5 values and create a row for each value
Why would you do such a thing?
This would denormalize...
May 14, 2014 at 4:38 pm
You might need to create a dynamic cross tab. I'm not sure if you will face problems with some limitations on columns or strings.
Read about them in here: http://www.sqlservercentral.com/articles/Crosstab/65048/
May 14, 2014 at 4:24 pm
You need to use dynamic code. But that will open the possibility of SQL injection.
May 14, 2014 at 2:44 pm
mickyT (5/14/2014)
However having said that, this could be another way of attacking the problem
Until you find that Gordon Abraham and Abraham Gordon (or any other combination of names) are two...
May 14, 2014 at 1:57 pm
Sean Lange (5/14/2014)
I would drop the mapping table and add another column to the Item table named ParentItemID. Then this is a simple recursive cte.
I saw the single parent-child relationship...
May 14, 2014 at 1:11 pm
You don't need UNION ALL. UNION will add rows and you need to add columns. To add columns, we use JOIN.
In this case, you need some kind of self join...
May 14, 2014 at 1:07 pm
Using the CASE and OVER clauses instead of reading three times the same table. 😉
;WITH T AS (
SELECT 1111 CustID, 201201 MonthID, 10001 Amt UNION
SELECT 1111...
May 14, 2014 at 12:50 pm
SQLRNNR (5/14/2014)
Luis Cazares (5/14/2014)
I'm afraid, "he-who-shall-not-be-named" is back in the forums.I hope that I can behave well enough.
Who? Tom Marvolo Riddle?
Close enough if you add nose, goatee and some...
May 14, 2014 at 11:50 am
You're assuming that all people think the same way.
People that think in sets, are very capable to understand commutativity so they can understand that a + b + c...
May 14, 2014 at 11:46 am
Maybe you're experiencing some kind of waits or blocking.
May 14, 2014 at 11:14 am
I'm afraid, "he-who-shall-not-be-named" is back in the forums.
I hope that I can behave well enough.
May 14, 2014 at 10:22 am
That will work to get a single value. If you need several values/groups, you could read about it in the following article:
http://www.sqlservercentral.com/articles/comma+separated+list/71700/
May 14, 2014 at 10:16 am
It's funny how Joe Celko can suggest that someone learns so many ISO standards and can't even learn an ANSI standard that has been out for 22 years. Please use...
May 14, 2014 at 10:07 am
Viewing 15 posts - 6,466 through 6,480 (of 8,731 total)