Just what it says.

Your first query attempts to list a column from a table that is not selected
from (building).

Your second query attempts to assign the alias "building" to both the
parcels table and the building table, and then subsequently does a join on
the building table.

Use the following (iuse table aliases for increased readability):

SELECT P.DXF as 'record',
    B.address as 'results1',
    P.relname as 'results2'
FROM parcels as P
    INNER JOIN building as B
    ON P.DXF = B.DXF
WHERE
    P.relname LIKE '%jones%'
ORDER BY
    P.relname desc;


HTH,
Tore.

----- Original Message -----
From: "Diver8" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 24, 2003 11:46 AM
Subject: Unknown table in field list


> Hi again.
>
> I've tried searching the list archives for this all
> morning, but they don't seem to be working (never get
> any results, page times out).  I found one report of
> this on google but the guy said he figured out the
> problem but didn't say what he did to fix it!
>
> I just added a table to my database (about four hours
> ago, actually).  This table is called 'building'.  My
> overall database looks like this:
>
> mysql> show tables;
> +------------------------+
> | Tables_in_tmp_db_work  |
> +------------------------+
> | building               |
> | parcels                |
> +------------------------+
> 2 rows in set (0.00 sec)
>
> I'm trying to run the following query:
>
> mysql> SELECT parcels.DXF as 'record',
> building.ADDRESS as 'results1', parcels.relname as
> 'results2' from parcels where parcels.relname like
> '%jones%' order by parcels.relname desc;
>
> That query returns:
>
> ERROR 1109: Unknown table 'building' in field list
>
> If I try this query instead:
>
> mysql> SELECT parcels.DXF as 'record',
> building.ADDRESS as 'results1', parcels.relname as
> 'results2' from  parcels building INNER JOIN building
> as building on parcels.DXF = building.DXF where
> parcels.relname LIKE '%jones%' order by
> parcels.relname desc;
>
> The query returns:
>
> ERROR 1066: Not unique table/alias: 'building'
>
> So what's wrong??
>
> Thanks.
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to