You most certainly can do what you want...but your example makes no sense to me.



Sound to me like "personnick" is text and absid is numeric -- they'll never 
match.



You can do something like:

delete from addressbook where absid in (select otherid from grouplinks where 
groupnick='27');



But what you really want is referential integrity.  See this

http://sqlite.org/foreignkeys.html



So when you delete the group the addressbook entries will automagically 
disappear.





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems

________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Simon [turne...@gmail.com]
Sent: Tuesday, May 01, 2012 2:08 PM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Using a select with 'where'

> >>  delete from addressbook where absid=(select personnick from grouplinks
> where
> >> groupnick='27')
> >>
> >> The 'select personnick ...' can return zero, one, or many results, and
> I'd
> >> like to have the 'delete from ...' delete zero, one, or many rows from
> the
> >> addressbook table. How can I do that with a single statement in SQLite,
> or is
> >> it not possible?
>

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to