November 1, 2018 at 3:03 am
Hi ALL,
i have a 2 select results ..finaly i select singel statement like below example
1 select statement
select 'topStories' as First
2 select statemnet results
Present_Position prese_url Previous_Position previ_url
1 https://www.thestar.com.my/tech/tech-news/2018/10/29/race-to-reinvent/ 1 https://www.ft.com/content/51c2c41a-d8fe-11e8-a854-33d6f82e62f8
2 https://www.telegraph.co.uk/politics/2018/10/28/no-wonder-dysons-singapore-britain-currently-doomed-humiliation/ 2 https://www.telegraph.co.uk/politics/2018/10/28/no-wonder-dysons-singapore-britain-currently-doomed-humiliation/
3 https://gas2.org/2018/10/27/dyson-electric-car-to-be-built-in-singapore/ 3 https://www.thestar.com.my/tech/tech-news/2018/10/29/race-to-reinvent/
Finaly i want display the results like
First
-----------------------------------------------------------------
'topStories'
--------------------------------------------------------------------------------------------
1 https://www.thestar.com.my/tech/tech-news/2018/10/29/race-to-reinvent/ 1 https://www.ft.com/content/51c2c41a-d8fe-11e8-a854-33d6f82e62f8
2 https://www.telegraph.co.uk/politics/2018/10/28/no-wonder-dysons-singapore-britain-currently-doomed-humiliation/ 2 https://www.telegraph.co.uk/politics/2018/10/28/no-wonder-dysons-singapore-britain-currently-doomed-humiliation/
3 https://gas2.org/2018/10/27/dyson-electric-car-to-be-built-in-singapore/ 3 https://www.thestar.com.my/tech/tech-news/2018/10/29/race-to-reinvent/
Please help me
Two querys like
select 'topStories'
AND
select
a.position as Present_Position,
prese_url,
b.position as Previous_Position,
previ_url
from
(select position,type,url as prese_url from @xmldata1 where type='topStories'
) A full outer join
(select position,type,url as previ_url from @xmldata6 where type='topStories'
) B ON a.type=B.type
and a.position=b.position
November 1, 2018 at 3:06 am
It might post be me, but I'm really struggling to see what you're asking here. It just looks like a bunch of links with some unformatted SQL sandwiched in. Can you format you post please? Have a look at the link in my signature for help.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 1, 2018 at 5:06 am
I think what you're going for is best satisfied by using UNION ALL (bit of a guess). The key is that each of the two SELECT statements have to have the same column names (aliases work fine) with the same data types. Otherwise, I'm not sure what you need.
----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply