85 Posts
kromoadv
6 years ago
Topic

Hi Sebloders,

i'm trying to filter articles by years (eg: 2015, 2016, 2017) in a list & serach type with the following free query in a select dynamic field to retrieve just the year of published articles

SELECT DISTINCT YEAR (publish_up) FROM #__content WHERE catid IN ( 16, 17, 18, 19 ) ORDER BY publish_up DESC

but the serach doesn't filter... it shows all the articles of any date whatever option i select.

Any suggestion please?

Thx in advance

Get a VIP membership
4229 Posts
Kadministrator
6 years ago
1
Level 1

This query tells nothing about the search, it just selects years for select. You need to enable debugging in search type to see search query.

85 Posts
kromoadv
6 years ago
0
Level 2

Hi Klas,

thanks for the quick reply.

I changed the query this way:

SELECT DISTINCT YEAR (publish_up) as value FROM #__content WHERE catid IN ( 16, 17, 18, 19 ) ORDER BY publish_up DESC

I also had to change the storage of my custom field to publish_up column.

Now the search works as expected.

Thank you

Luca

Get a VIP membership