hello friends having following table structure of quote table
i want access similar quotes (which have same author_id , category_id) particular _id(quoteid)
earlier
similar quotes means columns of rows of table of same category_id and same author_id. 2 quotes can considered similar if authors same , category same.
so using following query this
select `related_quote`.* `quote` `main_quote` left join `quote` `related_quote` using(`author_id`, `category_id`) `main_quote`.`_id` = quote_id
but other requirement definition of similar quotes changed
similar quotes means columns of rows of table of same category_id or same author_id. 2 quotes can considered similar if authors same , category same.
please me create query or condition in adv
select related_quote.* quote main_quote left join quote related_quote on (related_quote.author_id = main_quote.author_id or related_quote.category_id = main_quote.category_id) main_quote._id = main_quote._id
Comments
Post a Comment