{"action":"opened","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/5066","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/5066/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/5066/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/5066/events","html_url":"https://github.com/sequelize/sequelize/issues/5066","id":122743425,"number":5066,"title":"Filter multiple joined tables?","user":{"login":"menoz15","id":15675074,"avatar_url":"https://avatars.githubusercontent.com/u/15675074?v=3","gravatar_id":"","url":"https://api.github.com/users/menoz15","html_url":"https://github.com/menoz15","followers_url":"https://api.github.com/users/menoz15/followers","following_url":"https://api.github.com/users/menoz15/following{/other_user}","gists_url":"https://api.github.com/users/menoz15/gists{/gist_id}","starred_url":"https://api.github.com/users/menoz15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/menoz15/subscriptions","organizations_url":"https://api.github.com/users/menoz15/orgs","repos_url":"https://api.github.com/users/menoz15/repos","events_url":"https://api.github.com/users/menoz15/events{/privacy}","received_events_url":"https://api.github.com/users/menoz15/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-17T14:21:34Z","updated_at":"2015-12-17T14:21:34Z","closed_at":null,"body":"Hello everybody,\r\nI'm stuck with this problem and can't seem to find a solution. I have multiple tables arranged in a star schema (fact table in the middle, descriptive tables around it, joined by IDs). \r\n\r\nFactTable's model consist in an unique ID and two other columns, one for FirstContentId and the other for SecondContentId.\r\n\r\nI can successfully get all the joined data using *include*\r\n\r\n    models.FactTable.findAll({ \r\n\t\tattributes: ['Id', 'IdFirstContent', 'IdSecondContent'],\r\n\t\tinclude: [\r\n\t\t{\r\n\t\t\tmodel: models.FirstContent,\r\n\t\t\tattributes: ['Id','Description'],\r\n\t\t}, {\r\n\t\t\tmodel: models.SecondContent,\r\n\t\t\tattributes: ['Id','Description'],\r\n\t\t}],\r\n        where ...\r\n\r\nNow my question: I have a filter keyword and would like to filter both FirstContent.Description or SecondContent.Description with this. \r\n\r\nI would basically like to write something like this in SQL:\r\n\r\n    WHERE FirstContent.Description LIKE '%Filter%' OR SecondContent.Description LIKE '%Filter%'\r\n\r\nI can't put this clause in the \"include\" part, since it would filter only that content, and not both.\r\nI tried putting this clause in the final where but I get an error when writing models.FirstContent, saying the dot is an unexpected token.\r\n\r\nHow can I solve this problem?\r\nThank you very much"}}