MySQL: is there any MySQL workaround for this simple view subquery? (solved) -


i know cant subquery inside clause view in mysql. (error 1349)

is there workaround simple statement.

create view view     select *    (        select credits.id,credits,bonus         credits,bonus         credits.id = bonus.id        order credits.date desc, bonus.date desc    ) tmp    group id 

this want id credits bonus 1 1300 2 2 23 40 3 3045 134

edit: resolved correlative sql query.

yes. first, write query correctly. query depending on order by working in subquery, although mysql doesn't guarantee this.

i speculating want records credits along recent bonus record. without sample data, desired results, , data layouts, can hard interpret queries.

instead, should use not exists:

create view view      select c.id, c.credits, b.bonus     credits c join          bonus b          on c.id = b.id     not exists (select 1                       bonus b2                       b2.id = b.id , b2.date > b.date                      ); 

subqueries allowed in where (and select clauses).


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -