Hi

Hi I want to query multiple tables and think I need a little help

Using this example I have 2 tables

Table1

Table Name: one
Field: Surname
Field: Setnumber

Table2

Table Name: two
Field: Surname
Field: Setnumber

Using:

SELECT COUNT(*) AS res, FROM one, two where one.surname like  ('"&
globsurname & "') or two.surname like  ('"& globsurname & "')

Works fine, However I want to group the results by set number so did this:

SELECT COUNT(*) AS res, setnumber  FROM one, two where one.surname like
('"& globsurname & "') or two.surname like  ('"& globsurname & "') group by
setnumber

It fails with 'setnumber' in field list is ambiguous

Simplistically I want to search x number of tables for a surname (all the
tables have a surname column and a setnumber column ) and on the first pass
return how many searched names it found per set.


The user will then be able to focus on a set if required.

Regards
John Berman
[EMAIL PROTECTED]





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to