Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 fetch data from table into query

Author  Topic 

Ludger
Starting Member

1 Post

Posted - 2011-10-28 : 03:32:22
Hi all,

my task is to run a SELECT-query many times. The query is only changing in one parameter.In the syntax below the number 25080 has to be replaced with other numbers. The numbers reside in a table and have to be fetched from there. The query has to run with each number from that table and the result should be written in the result-table (in the syntax below the table xy ).
How can I do that? I am grateful for any help.
Cheers, Ludger

CREATE TABLE xy AS
SELECT *
FROM vertices_tmp
JOIN
(SELECT * FROM driving_distance('
SELECT ogc_fid AS id,
source::int4 AS source,
target::int4 AS target,
traveltime::float8 AS cost
FROM x',
25080,
60,
false,
false)) AS route
ON
vertices_tmp.id = route.vertex_id

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-10-28 : 04:18:27
This is a MS SQL Server forum only.
The syntax you have posted doesn't look like T-SQL/MS SQL Server.
I think you can get better help in another forum.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -