Delete extra channels from MythTV

November 12, 2006 on 6:40 pm | In General Nonsense |

I’ve been hunting around for a quick way to delete all the channels in my MythTV DVR that I don’t get with DirectTV. I went to Zap2It’s interface and removed them all, but all that did on  my end was give me a lot of “Unknown” in the program directory. I set out to write a query.

There was some old, outdated info in a FAQ somewhere that didn’t really help much. Also, MySQL won’t let you SELECT from the same table you’re doing a DELETE. So I had to use a temporary table and do it in two steps:

CREATE TEMPORARY TABLE tmptable SELECT c.chanid
FROM channel c
LEFT JOIN program p ON c.chanid = p.chanid
WHERE p.chanid IS NULL ;

DELETE channel
FROM
channel
INNER
JOIN tmptable ON channel.chanid = tmptable.chanid;

Hope this helps someone.

No Comments yet »

RSS feed for comments on this post.

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Powered by WordPress with Pool theme design by Borja Fernandez.
Valid XHTML and CSS. ^Top^