Again me with my queries in MySQL. Now I have the following query...
SELECT n.nid, n.type, n.title
FROM node n
INNER JOIN field_data_field_fecha_de_publicaci_n t_fp ON t_fp.entity_id = n.nid
INNER JOIN taxonomy_index t_index ON t_index.nid = n.nid AND t_index.tid = '4'
WHERE t_fp.field_fecha_de_publicaci_n_value <= '2020-08-06 15:07:00' AND n.type IN('foto','podcast','video', 'articulo')
ORDER by n.nid DESC
LIMIT 0, 3
Which gives me the following result:
The point is that if you type = 'articulo'
must do a validation so that it can show which one it is, look in the table field_data_field_agregar_video
for the field_agregar_video_value = 1
. Both tables share the same field in common: nid
.
If field_agregar_video_value = 1
the record is shown, otherwise, it is not shown but it must always be 3 records.
I had added this line just below the second INNER JOIN
but from then on it only shows me the ones that aretype = 'articulo'
INNER JOIN field_data_field_agregar_video t_av ON t_av.entity_id = n.nid AND t_av.field_agregar_video_value = '1'
Remove the LIMIT
for a better view:
If I did not misunderstand you, in the case of
articulos
, an additional condition is required, which isfield_agregar_video_value = 1
, you handle this byWHERE
considering the two possibilities (a) That it is 'article' and field_agregar_video_value = 1
or (b) That it is NOT 'article'