I have a table named user_requests which contain user requests, with fields
id title user_id channel_type programme_type status
Field status can have values 0,1,3 or 4. What I need is to query different tables based on channel_type and the status field value.
1) If channel_type is 0 and status is 4, query table channel_programmes with fields,
id title request_id channel_id
where request_id is the primary key of user_requests table.
If channel_type is 1, also query table videochannel with fields
id title thumbnail
where the primary key id is referred as foreign key in table channel_programmes (channel_id).
2) If channel_type is 0 and status value is 0,1,2 or 3, query table user_videos with fields,
id channel_id videotitle
and table videochannel (as described ablove) if channel_type is 1.
I need the whole to be done in two separate queries. ie, one for channel_type with value as 0 and another for channel_type with value as 1.
Can anyone help me to find an appropriate query for this?
Thanks in advance.