带有另一列

时间:2018-01-10 21:58:26

标签: sql sql-update concatenation

这是我想要做的: 我有这张桌子

+----+-------------+  
| id | data        |  
+----+-------------+  
|  1 | max         |  
|  2 | linda       |  
|  3 | sam         |  
|  4 | henry       |  
+----+-------------+ 

我希望用数据连接Id列更新数据,如下所示:

+----+-------------+  
| id | data        |  
+----+-------------+  
|  1 | max1        |  
|  2 | linda2      |  
|  3 | sam3        |  
|  4 | henry4      |  
+----+-------------+ 

1 个答案:

答案 0 :(得分:1)

这听起来基本上就是你想要的(T-SQL,其他平台可能有不同的类型转换和连接方法):

source "https://rubygems.org"

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem "rails"
gem "puma"
gem "dotenv-rails"
gem "newrelic_rpm"
gem "simple_form"
gem "timeliness"
gem "validates_timeliness"
gem "responders"
gem "better_errors"
gem "parsley-rails"
gem "jquery-rails"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

source "[...]" do
  gem "apophenia-rails-logger"
  gem "dr_theme", "~> 5"
  gem "lead"
  gem "ramsey_validators"
end

group :development, :test, :build do
  gem "sass-rails", "~> 5.0"
  gem "autoprefixer-rails"
  gem "sprockets-es6"
end

group :development, :test do
  # Call "byebug" anywhere in the code to stop execution and get a debugger console
  gem "byebug", platform: :mri
  gem "rspec-rails"
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem "web-console", ">= 3.3.0"
  gem "listen", "~> 3.0.5"
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem "spring"
  gem "spring-watcher-listen", "~> 2.0.0"
  gem "spring-commands-rspec"

  gem "fuubar"
  gem "vcr"
  gem "webmock", require: false
  gem "capybara"
  gem "poltergeist"

  gem "i18n-debug", require: false # turn this on to log out I18n localization lookups
end

group :production do
  gem "uglifier"
end