snipt

Ctrl+h for KB shortcuts

SQL

Select images and galeries from Drupal Acidfree gallery

SELECT f.filepath,td.name FROM node n JOIN files f ON f.nid=n.nid JOIN term_node tn ON tn.nid=n.nid JOIN term_data td ON td.tid=tn.tid WHERE n.type='image' AND filename='_original' ORDER BY td.name
https://snippets.siftie.com/embed/25fa9dbfefeb17c93fec0e7d42ef3ce0/
/raw/25fa9dbfefeb17c93fec0e7d42ef3ce0/
25fa9dbfefeb17c93fec0e7d42ef3ce0
sql
SQL
1
2019-03-09T14:48:09
True
False
False
/api/public/snipt/3807/
select-images-and-galeries-from-drupal-acidfree-gallery
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">SELECT</span> <span class="n">f</span><span class="p">.</span><span class="n">filepath</span><span class="p">,</span><span class="n">td</span><span class="p">.</span><span class="n">name</span> <span class="k">FROM</span> <span class="n">node</span> <span class="n">n</span> <span class="k">JOIN</span> <span class="n">files</span> <span class="n">f</span> <span class="k">ON</span> <span class="n">f</span><span class="p">.</span><span class="n">nid</span><span class="o">=</span><span class="n">n</span><span class="p">.</span><span class="n">nid</span> <span class="k">JOIN</span> <span class="n">term_node</span> <span class="n">tn</span> <span class="k">ON</span> <span class="n">tn</span><span class="p">.</span><span class="n">nid</span><span class="o">=</span><span class="n">n</span><span class="p">.</span><span class="n">nid</span> <span class="k">JOIN</span> <span class="n">term_data</span> <span class="n">td</span> <span class="k">ON</span> <span class="n">td</span><span class="p">.</span><span class="n">tid</span><span class="o">=</span><span class="n">tn</span><span class="p">.</span><span class="n">tid</span> <span class="k">WHERE</span> <span class="n">n</span><span class="p">.</span><span class="k">type</span><span class="o">=</span><span class="s1">&#39;image&#39;</span> <span class="k">AND</span> <span class="n">filename</span><span class="o">=</span><span class="s1">&#39;_original&#39;</span> <span class="k">ORDER</span> <span class="k">BY</span> <span class="n">td</span><span class="p">.</span><span class="n">name</span> </span></pre></div> </td></tr></table>
acidfree, drupal, sql