I have two tables that are not related at all
First table is called pocetna_baner
that stores 3 pictures that are going to be displayed on index page.
pocetna_baner table:
Second table is for blog and I want to take information of 3 blogs ordered by datum desc:
blog table
I tried using UNION, UNION ALL, JOIN without clauses, full outer join, but just cannot get it to work because I never had this situation where there is no on clause
union all with queries that have a different number of columns -> I searched for answers and got to this one which seemed okay but unfortunately couldn't get it to work
This is what I have by now
(SELECT null as blog_id, null as naslov, null as tekst1, null as kategorija, p.ime_slike FROM
pocetna_baner p )
UNION ALL
(SELECT b.blog_id, b.naslov, b.tekst1, b.kategorija ,null as ime_slike
FROM blog b ORDER BY b.datum DESC LIMIT 3 )
And result is this
My expected output is only to take b.blog_id, b.naslov, b.tekst1, b.kategorija FROM blog b
ordered by datume desc limit 3 and add column with ime_slike
from second table