>
>
> SELECT A.*
> ,E.fk_media,E.nrscanpages,E.dateOfArticle,E.createdate,E.ID,E.title,E.body,E.subtitle,E.author,E.summary
> FROM
> (SELECT CA.* from econtracts_articles AS CA
> WHERE CA.fk_econtract IN (SELECT fk_contract FROM
> ecust_user_contract WHERE fk_cust_user='ukommiha')
> AND CA.articledate BETWEEN '2018.01.01' AND
> '2020.02.02') as A
> JOIN earticles AS E ON A.fk_earticle = E.ID
> WHERE (UPPER(CONCAT_WS(title,' ',subtitle,'
> ',body,' ',author,' ',summary)) LIKE '%drzava%' )
> GROUP BY E.id ORDER BY E.dateOfArticle ASC LIMIT
> 0,10
>
>
Sorry a copy/paste error, no need for "group by" when I have distinct in a subquery (no difference for those 10 rows after) :
SELECT A.* ,E.fk_media,E.nrscanpages,E.dateOfArticle,E.createdate,E.ID,E.title,E.body,E.subtitle,E.author,E.summary
FROM
(SELECT DISTINCT CA.* from econtracts_articles AS CA
WHERE CA.fk_econtract IN (SELECT fk_contract FROM ecust_user_contract WHERE fk_cust_user='ukommiha') AND CA.articledate BETWEEN '2018.01.01' AND '2020.02.02') as A
JOIN earticles AS E ON A.fk_earticle = E.ID
WHERE (UPPER(CONCAT_WS(title,' ',subtitle,' ',body,' ',author,' ',summary)) LIKE '%drzava%' ) ORDER BY E.dateOfArticle ASC LIMIT 0,10