From: efrazier Date: March 16 1999 12:23am Subject: Re: returning table name List-Archive: http://lists.mysql.com/mysql/291 Message-Id: <2.2.32.19990316002302.00e0242c@192.168.0.1> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Hi, It looks like the below would be easy with the data reorganized as Tim suggested. I was wondering about a simlair question in reverse though. I have three tables that share a item ID as their primary keys , When I delete an item from the database I need to remove the records from each of these three tables by itemID. Something like DELETE books.*, fbooks.*, sbooks.* FROM books,fbooks, sbooks WHERE books.index=fbooks.index AND books.index =3; But of course this doesn't work. Can it work? Can you use something like an INNER JOIN with the DELETE? Thanks, Eric At 05:16 PM 3/15/99 -0700, you wrote: >On Tue, Mar 16, 1999 at 01:14:20AM +0100, sinisa@stripped wrote: >>Marc Antony Vose writes: >>> So, I'd like it to return the table name along with each row, like so: >>> >>> name table >>> >>> Baseball games >>> Blah Blah utilities >>> Joystick X hardware >>> Quake games >> >> No, it is not possible, you must have three queries. In any SQL the >> same field name, like 'name', used by three table would in a single >> query produce 'ambiguous field name' error. > >Marc Antony, you might want to reorganize your data. You can >put the "table" from above into the games table. Then you >would trivially get the information you want by simply selecting >two fields from the same table. > >If you want to query only utilities, well it's as simple as adding >"AND table = 'utilities'" at the end of your WHERE clause. > >Tim > >--------------------------------------------------------------------- >To request this thread, e-mail mysql-thread288@stripped >To unsubscribe, e-mail the address shown in the >List-Unsubscribe header of this message. >For additional commands, e-mail: mysql-help@stripped > >