mysql - Understanding this query (COUNT & subquery) -


i'm having trouble understanding query:

select *    `advertise` parent   3  <= ( select count(username)                   `advertise`                  keyword = parent.keyword                    , bid > parent.bid)     , username = 'mike' 

what query display rows username 'mike'; if row not in 3 highest bids keyword.

here sqlfiddle works, don't understand how works. more don't understand 3 <= specific query.

how 3 <= determine row not in 3 highest bids keyword?

this query works so:

the subquery

select count(username) `advertise` keyword = parent.keyword , bid > parent.bid 

finds number of rows have higher bid same keyword. specify bid looking cannot in top 3 bids, require @ least 3 bids returned query. here think end query should like:

select * `advertise` parent  3  <= ( select count(username)      `advertise`      keyword = parent.keyword      , bid > parent.bid)  , username = 'mike' 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -