473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Join problem (5.0.4 beta)

Hi,

I am trying to convert a Powerbuilder program from Sybase SQLA to
MySQL. The following select works fine with Sybase but I can't get
MySQL to accept it.

SELECT ....
FROM clients LEFT OUTER JOIN country ON clients.country =
country.country_code,
salutations LEFT OUTER JOIN clients ON clients.salutation =
salutations.salut
WHERE clients.client_id = :id

MySQL returns the error SQLSTATE = S1T00 Not unique table/alias:
'clients'.

Can anyone shed any light?
Thanks,
Gerry.
Powerbuilder 10
MySQL 5.0.4 beta
MyODBC 3.51.11-2
Jul 23 '05 #1
3 1549
On 22/05/2005, Gerry wrote:
SELECT ....
FROM clients
LEFT OUTER JOIN country ON clients.country = country.country_code, salutations LEFT OUTER JOIN clients ON clients.salutation =
salutations.salut


Are you sure you don't want

LEFT OUTER JOIN salutations ON salutations.salut = clients.salutations

--
felix
Jul 23 '05 #2
Gerry wrote:
Hi,

I am trying to convert a Powerbuilder program from Sybase SQLA to
MySQL. The following select works fine with Sybase but I can't get
MySQL to accept it.

SELECT ....
FROM clients LEFT OUTER JOIN country ON clients.country =
country.country_code,
salutations LEFT OUTER JOIN clients ON clients.salutation =
salutations.salut
WHERE clients.client_id = :id

MySQL returns the error SQLSTATE = S1T00 Not unique table/alias:
'clients'.


That error is normal. You've used the clients table twice in your join,
so the parser can't tell which one is supposed to be the one used in the
condition in your WHERE clause.

Try using row aliases:

SELECT ....
FROM clients AS c LEFT OUTER JOIN country AS co ON c.country =
co.country_code,
salutations AS s LEFT OUTER JOIN clients AS c2 ON c2.salutation =
s.salut
WHERE c.client_id = :id

Also, I do not see any join condition between the first two tables and
the latter two tables; you're creating a cartesian product. This
doesn't have anything to do with the error you got, and in fact it is
not an error. But I'm guessing it's not going to give you the result
you want.

I'm also curious why you are using outer joins. For example, I would
not expect there to be country codes in the clients table that don't
appear in the country table. I would guess the country table is a
lookup table, containing all possible country codes. This should be a
superset of the countries mentioned in records in the client table.

The outer join with salutations makes even less sense.

Regards,
Bill K.
Jul 23 '05 #3
Thanks guys, for the response.

Yes, you are correct, the outer/inner joins were not too logical as I
was trying all possible combinations to get mysql to accept the select
:-/
I am embarrassed to say I have found the problem. I had a good nights
sleep and started afresh with the mysql manual instead of trying to
get the powerbuilder generated code to work.
I am afraid that the conversion Powerbuilder/Sybase -> MySQL is not as
easy as I at first thought.
Thank you for spending time listening and I am sorry to have wasted
your time with a bit of a dumb question.

Gerry.
On Sun, 22 May 2005 17:54:50 +0200, Gerry <ge****@xs4all.nl> wrote:
Hi,

I am trying to convert a Powerbuilder program from Sybase SQLA to
MySQL. The following select works fine with Sybase but I can't get
MySQL to accept it.

SELECT ....
FROM clients LEFT OUTER JOIN country ON clients.country =
country.country_code,
salutations LEFT OUTER JOIN clients ON clients.salutation =
salutations.salut
WHERE clients.client_id = :id

MySQL returns the error SQLSTATE = S1T00 Not unique table/alias:
'clients'.

Can anyone shed any light?
Thanks,
Gerry.
Powerbuilder 10
MySQL 5.0.4 beta
MyODBC 3.51.11-2


Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert Hathaway | last post by:
COMP.OBJECT FAQ Version II Beta now Available http://www.objectfaq.com/oofaq2 ================================================== - Latest Important Information on Object Technology - What's New...
0
by: Harry von Borstel | last post by:
Hello database friends, We are seeking beta testers for our upcoming "blueshell Data Guy Professional". This new application is an extension to our award-winning universal database editor...
3
by: RdR | last post by:
Hello all, Any information on how to join the "Serrano" Beta for the Next Websphere Information Integrator? Also info on how to join also the "Hawk" Beta? Supposed to be betas for enhancing...
0
by: Sebastian Ware | last post by:
O/R Mapping. After six months of hard work, we are proud to make available the Public Beta of Pragmatier Data Tier Builder 2.5. Initial feedback is amazing, download NOW and find out for yourself:...
2
by: Jesse Liberty | last post by:
This is a one time request for beta-readers for a new book I'm working on. ************* I'm writing a new book on Visual C# 2.0 - target audience is C# 1.x programmers looking to move up to...
1
by: Eric Sassaman [MS] | last post by:
Online Chat: Visual C++ 2005 Beta Join the Visual C++ team to discuss your questions and comments on the Beta release of Visual C++ 2005. Whether you are a first-time user of the Visual C++...
1
by: jake | last post by:
Hello, I read an article about how the Xp Pro SP2 could have the potential to affect applications. In the article it mentioned about getting the beta version of SP2 to test against. Where can I...
0
by: Heiko Wundram | last post by:
Hi all! It's been a while since I've announced a version of PyAuthD, and we're nearing a 0.1 release steadily. Beta 6 marks a milestone as the current release has been powering the backend of...
33
by: Serge Rielau | last post by:
Hi folks, My fellow team mates had some extra time on their hands so we decided to spice up DB2 with a grab-bag of compatibility features. We wouldn't mind help validating the semantics...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.