<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>madogiwa0124</author_name>
  <author_url>https://blog.hatena.ne.jp/madogiwa0124/</author_url>
  <blog_title>Madogiwa Blog</blog_title>
  <blog_url>https://madogiwa0124.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby on Rails</anon>
  </categories>
  <description>はじめに Railsのアプリを作ってて、複数TBLを結合した結果をGROUP BYで集計するような、ちょっと複雑な検索処理が必要となり生のSQLを実行したかったので、そのやり方をメモしましたφ(..) やりかた SELECT文の場合は、ActiveRecord::Base.connection.select_allの引数にSQLの文字列を与えてあげればOK(/･ω･)/ 返り値をto_hashしてあげれば、[{&quot;column1&quot; =&gt; &quot;hoge1&quot;,&quot;column2&quot; =&gt; &quot;hoge2&quot;},{&quot;column1&quot; =&gt; &quot;hoge1&quot;,&quot;column2&quot; =&gt; &quot;hoge2&quot;}...]のよう…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmadogiwa0124.hatenablog.com%2Fentry%2F2017%2F08%2F28%2F000127&quot; title=&quot;Ruby on Rails:生のSQLを作成(直書き)して実行させる方法 - Madogiwa Blog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://images-fe.ssl-images-amazon.com/images/I/51k5wqPu7jL._SL160_.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-08-28 00:01:27</published>
  <title>Ruby on Rails:生のSQLを作成(直書き)して実行させる方法</title>
  <type>rich</type>
  <url>https://madogiwa0124.hatenablog.com/entry/2017/08/28/000127</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
