I have two types of advert messages on my site: Text and Video which are scheduled to go out later on. So I have a Text table, Video table, TextMsgScheduled table and VideoMsgScheduled.
I want my customers to be able to look at all their messages chronologically in a dynamic slider which I have up and running. However I need to populate the slider with the details of the Text and Video Messages.
So I have been trying to query the DB to give me the list of TEXT messages and the list of Videos messages for a particular customer. I can list the text messages alone and I can list the video messages alone but not combine them. See the below queries which work fine individually
SELECT * FROM `txtmsgscheduled` join `txtmsg` on txtmsg.txtmsgId=txtmsgscheduled.txtmsgId where txtmsgscheduled.UserId = '50d16ee5-2f63-417a-b315-356a7c6dc8ec')
SELECT * join `videos` on videomsgscheduled.videoID= videos.videoID where videomsgscheduled.userID = '50d16ee5-2f63-417a-b315-356a7c6dc8ec'
I would like to be able to combine the results of both queries so that I can loop through them in php on my site, identify which type they are and add them to my slider in chronological order. The slider can take different content types.
I am unsure the best way of doing this. Both resulting query tables have different columns types and numbers of columns so a Union doesn’t seems to be possible.
Any suggestions would be great
Thanks in advance