hello ,
please i'm trying this code in sql and i want the result to be in one table not in different table 
hello ,
please i'm trying this code in sql and i want the result to be in one table not in different table 
Hi @asmagh-9402,
Could you please validate all the answers so far and provide any update?
Please remember to accept the answers if they helped. Your action would be helpful to other users who encounter the same issue and read this thread.
Thank you for understanding!
Best regards,
Melissa
You can use the Set Operators - UNION (Transact-SQL) to concatenate the result of two queries.
But for this it's mandatory that both (or more) queries returns the same count of columns and data types.
display one result with while in sql
I missed your WHILE loop; that's when one post images instead of code.
Why a loop?
You can insert the query result into a temp table or table variable and query the result at the end of your loop.
Hi @asmagh-9402,
Welcome to Microsoft Q&A!
It is recommended for you to post the complete query together with CREATE TABLE statements for your tables together with INSERT statements with sample data instead of snapshot.
You could have a try to create one template table and store all results under loop into this template table.
Please refer below example:
DROP TABLE IF EXISTS #temp
create table #temp
(ADATE DATE,ID INT,DATEE DATE)
declare @i date
set @i='2021-01-01'
while (@i<='2021-01-31')
begin
insert into #temp
select @i,id, convert(date,CONCAT...
from dbo.ods_arrangment arr
where convert...
set @i=DATEADD(day,7,@i)
end
select * from #temp
Since your snapshot is not a complete one, please fulfill above ellipsis part with your actual one.
Best regards,
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
13 people are following this question.