You are here: Re: SQLite3 and PHP « PHP Programming Language « IT news, forums, messages
Re: SQLite3 and PHP

Posted by Tim Roberts on 04/30/07 05:29

Jon <yu.jono@gmail.com> wrote:

>Hi,
>
>I'm having some trouble trying to get DELETE to work with SQLITE3 and
>PHP and was wondering if anyone could be of some assistance?
>
>I have verified that it is set up correctly and I'm able to insert /
>create / select from tables but I'm unable to delete specific entries.
>
>Given the following 2 tables:
>
>Table A Table B
>Name Cost Name Cost
>A 1 D
>3
>B 2 E
>5
>C 3 F
>7
>
>how would I delete entries with the same cost?

You want to delete from BOTH tables?

Deleting from one table is easy:

DELETE FROM tablea WHERE cost IN
(SELECT cost FROM tableb);

To delete from both tables, you'll have to copy the costs that are
duplicated into a temporary table, and then use that in a subselect. Or,
grab the SELECT results into a variable and construct the DELETE yourself.

SELECT tablea.cost FROM tablea,tableb WHERE tablea.cost=tableb.cost;
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация