Note that there are some explanatory texts on larger screens.

plurals
  1. POSubquery returns more than 1 row sql query
    primarykey
    data
    text
    <p>I had such an error can explain what I did wrong? <br /> I only add this sql query: <br /></p> <pre><code> (? = (select travel_region_id from relationships where travel_id = travels.id)) </code></pre> <p>error</p> <pre><code>ActiveRecord::StatementInvalid (Mysql::Error: Subquery returns more than 1 row: select count(*) from travel_start_days, cars, travels where travels.id = travel_start_days.travel_id and travels.id = travel.car_id and travel_start_days.day &gt; adddate(curdate(), interval '2' day) and (7 = (select travel_region_id from relationships where travel_id = travels.id)) and '2013-08-16' &lt;= travel_start_days.day): </code></pre> <p><strong>Update</strong> Whis is method create query</p> <pre><code>def conditions where = '' param = [] if @region &amp;&amp; @region != '' where += 'travels.region_id = ?' param += [@region.to_i] end if @car &amp;&amp; @car != '' where += ' and ' if where != '' where += 'cars.id = ?' param += [@car.to_i] end if @relation &amp;&amp; @relation != '' where += ' and ' if where != '' where += '(? = (select travel_region_id from relationships where travel_id = travels.id))' param += [@relation.to_i] end if @start_port &amp;&amp; @start_port != '' where += ' and ' if where != '' where += '(? = (select location_id from travel_days where travel_id = travel_start_days.travel_id and day_no = 1 order by arrival asc limit 1))' param += [@start_port.to_i] end return where == '' ? nil : ["travel_start_days.day &gt; adddate(curdate(), interval ? day) and " + where] + [@criteria[5]] + param end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload