[vox-tech] MySQL 3.x - deleting orphan rows & datetime()
Foo Lim
vox-tech@lists.lugod.org
Fri, 7 May 2004 15:20:41 -0700 (PDT)
On Fri, 7 May 2004, David Siedband wrote:
> Greetings,
>
> I have two questions - using MySQL 3.x
>
> [1] I'm trying to craft an SQL query to delete orphan rows in index
> tables
>
> something like:
>
> delete from DocWords left join Docs on Docs.ID = DocWords.DocID where
> Doc.ID is null
>
> Any suggestions how to do this?
Hi David,
Try using a subquery:
delete from DocWords
where DocID not in
(select ID from Docs);
> [2] Is it possible to emulate the functionality of difftime() in MySQL
> 3.x without using a scripting language?
I will defer this to someone who knows more than I do...
> thanks!
> --
> David
HTH,
Foo