Viewing 15 posts - 1 through 15 (of 68 total)
yes, i think when use FULL JOIN then it is a UNION.
because the structure of tables(A&B) not same, i think i will be using FULL JOIN for queries.
August 1, 2012 at 1:47 am
Koen Verbeeck (8/1/2012)
August 1, 2012 at 12:59 am
Koen Verbeeck (8/1/2012)
What's wrong with union?Since TSQL offers only union, intersect and except, any solution that I can think of right now involves union.
because performance, the tables A,B have large...
August 1, 2012 at 12:25 am
dwain.c (2/28/2012)
Try this:
SELECT id, date, [value]
FROM (
SELECT *, ROW_NUMBER() OVER (PARTITION BY id ORDER BY id, date DESC) AS rk
FROM [temp]
) x
WHERE rk = 1
Thanks dwain.c
It's working fine for me.
February 28, 2012 at 3:27 am
Thank Jeff Moden for your support. 😀
June 16, 2011 at 9:53 pm
Hi Jeff Moden.
I'm remove *, from the code and result is:
A
--A1
----A1.1
------Item Code = 3
--A2
----A2.1
------Item Code = 1
----A2.2
------Item Code = 2
--A3
B
C
But i need result is:
A
--A2
----A2.1
------Item Code = 1
----A2.2
------Item Code = 2
--A1
----A1.1
------Item...
June 16, 2011 at 7:10 pm
Thank for you post. But i need result like this:
A
--A2
----A2.1
------Item code = 1
----A2.2
------Item code = 2
--A1
----A1.1
------Item code = 3
--A3
B
C
Please help/support me.
June 16, 2011 at 3:06 am
ah, My customer make sure: no data like this:
A
--A1
----A1.1
--A2
----A2.2
------Item code = 3
------A2.2.1
--------Item code = 1
--A3
B
--Item code = 2
C
Every data input are reasonable.
June 15, 2011 at 10:59 pm
For result:
A
--A1
----A1.1
------Beck
--A2
----A2.1
------Ronaldo
----A2.2
------Messi
--A3
B
C
I have a SQL:
DECLARE @Folder_Item TABLE(
IdFolder int,
FolderName varchar(1024),
IdFolderParent int,
ItemCode nvarchar(7)
)
INSERT INTO@Folder_Item (
IdFolder,
FolderName,
IdFolderParent,
ItemCode
)
SELECTIdFolder,
FolderName,
IdFolderParent,
'' as ItemCode
FROMFolders
UNIONALL
SELECTIdFolder*10000+ItemCode,
ItemName,
IdFolder,
ItemCode
FROMItems
;WITH FamilyNode AS
(
(SELECT Folder.IdFolder,
Folder.FolderName,
Folder.IdFolderParent,
Folder.ItemCode,
1 AS LevelRoot,
CAST(ROW_NUMBER()...
June 15, 2011 at 10:51 pm
order by and select top 1
@The Dixie Flatline: thank you so much
September 20, 2010 at 9:48 pm
ColdCoffee (9/6/2010)
Will tables A, B and C have only one row per table all the time?
No, may be many have row all the time
ex:
A(1,1),B(2,2),B(4,4),C(3,3)
@CheckA=1,@CheckB=1,@CheckC=1
Result:
A1 A2 B1 B2 C1 C2
1 ...
September 6, 2010 at 1:41 am
GilaMonster (7/2/2010)
Don't understand your question. i have a question for you though. Why are you using a cursor?
I have 2 testcase:
1: OPEN cursor error
2: COMMIT error
But i don't know when...
July 5, 2010 at 3:29 am
HÃc, i found this solution in http://support.microsoft.com/kb/273586
It say:
The following INSERT INTO SELECT FROM query with an ORDER BY clause will guarantee that column ID in NewTable is in...
June 22, 2010 at 1:54 am
GilaMonster (6/21/2010)
Steve Cullen (6/21/2010)
It really doesn't matter what in order you load the table, you order it on the select out, or use a clustered index.
There's no OR here. If...
June 22, 2010 at 1:00 am
😀 My Flow IS:
- Truncate table @AAAATABLE
- INSERT INTO @AAAATABLE from @DATATABLE with ORDER BY V1,V2
- SELECT * FROM @AAAATABLE ORDER BY K
I want a result with ordered by V1,V2...
June 21, 2010 at 10:41 pm
Viewing 15 posts - 1 through 15 (of 68 total)