Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL query shows results, but I can't restrict by them?
    primarykey
    data
    text
    <p>Hi I have a query like so</p> <pre><code>SELECT videos.*, categories.cat_name , ( SELECT COUNT( * ) AS count FROM user_favorites WHERE user_id = 'tw415656866' AND video_id = videos.video_id )is_favorite FROM `videos` INNER JOIN categories ON categories.cat_id = videos.cat_id WHERE date &lt;= '2011-11-21 09:12:18' GROUP BY videos.video_id ORDER BY (votesdown / votesup) ASC LIMIT 0, 5 </code></pre> <p>This code works fine and returns a table like below</p> <p>video_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- video id<br/> cat_name&nbsp;&nbsp;&nbsp;- category name<br/> cat_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- category id<br/> title&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- video title<br/> yt_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- youtubes video id<br/> votesup&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- votes up<br/> votesdown&nbsp;&nbsp;- votes down<br/> date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- date added<br/> tweeted&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 0 / 1 ( 1=tweeted)<br/> is_favorite&nbsp;&nbsp;&nbsp;- 0 / 1 ( 1=favorited)<br/></p> <p>What i'm trying to do is add this to the WHERE clause</p> <pre><code>AND is_favorite = 1 </code></pre> <p>As you can see 'is_favorite' is added to the dataset as a column but I cannot query it because MySQL says the column 'is_favorite' doesn't exist.</p> <p>The exact error is... " Unknown column 'is_favorite' in 'where clause' "</p> <p>Any ideas?</p> <p>Thanks alot</p>
    singulars
    1. This table or related slice is empty.
    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.
    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