title: Joomla Database - How to use LIMIT in getQuery?
body: <p>I want to build the below query using joomla inbuilt database class.</p>
  
  <pre><code>SELECT * 
  FROM table_name
  ORDER BY id DESC
  LIMIT 1
  </code></pre>
  
  <p>This is the query I have built up to now.</p>
  
  <pre><code>$db =&amp; JFactory::getDBO();       
  $query  = $db-&gt;getQuery(true);
  $query-&gt;select($db-&gt;nameQuote('*'));
  $query-&gt;from($db-&gt;nameQuote(TABLE_PREFIX.'table_name'));      
  $db-&gt;setQuery($query);      
  $rows = $db-&gt;loadObjectList();
  </code></pre>
  
  <p>I don't know how to add the limit(LIMIT 1) to the query. Can someone please tell me how to do it? Thanks</p>