Looping through a temporary table, comparing and setting values

I am looking for a way to be able to go through a CSV file or add the data of the CSV to a temporary table (I know how to do this part) and then compare the temporary table on one column with my permanent table and on the row it matches, set another column to a value within the temporary table.

if(Old_Url = Old Url)
  new_url = new_url

That's a bad code example of what I want to do as I have no idea how to show this in SQL


You don't loop (generally) in SQL - you write a query that applies to entire sets of rows.

It looks like you want some form of update:

SET new_url = t.new_url
FROM PermanentTable p
INNER JOIN TemporaryTable t
ON p.old_url = t.old_url

(Although you should be cautious if TemporaryTable might contain multiple rows with the same old_url value and different new_url values - it's not well defined which values will be applied to any matching rows in PermanentTable)

Need Your Help

Using nextInt with arrays (beginning java)

java arrays

For a programming assignment we have to create array methods that carry out different tasks.

Where to place a .txt file so that a java servlet can read it during runtime

java servlets file-io

I am using eclipse to make a dynamic webpage. Its a simple program that relies on servlets to pass/retrieve data. One servlet of mine has to open a .txt file to read its content and send it to the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.