[thelist] SQL: Help with a simple join

Jonathan Cone JCone at municode.com
Wed Jun 18 13:58:23 CDT 2003

-----Original Message-----
From: Casey Crookston [mailto:casey at thecrookstons.com]
Sent: Wednesday, June 18, 2003 2:34 PM
To: thelist at lists.evolt.org
Subject: [thelist] SQL: Help with a simple join

	your syntax is a little wrong.  First off, you only need to specify a table when you have field names that are the same in different tables.  
	But if you do use the table to identify the field, you should put the table first then the field.  ex. [table name].[field name], a.title.
	also when creating the alias in the FROM section you should not use a dot (but don't know if this is incorrect) ex: tb_employees a
	So your end result would be

Select a.first_name, a.last_nae, b.title
>From tb_employees a, tb_titles b
Where a.title_id = b.title_id
Order by last_name

hth, Jonathan
I now need to dispaly the first names, last names, and titles.  Help me out
a little with the SQL syntax:

SELECT first_name.a, last_name.a, title.b, FROM tb_employees.a, tb_titles.b
WHERE title_id.a = title_id.b ORDER BY last_name

Here's the error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] The SELECT statement includes a
reserved word or an argument name that is misspelled or missing, or the
punctuation is incorrect.
/boser/about/ind.asp, line 9


* * Please support the community that supports you.  * *

Evolt.org conference in London, July 25-27 2003.  Register today at http://evolt.org.uk

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 

More information about the thelist mailing list