This topic is locked

Join with alias causes error in view/add 3.0 Build 118

8/23/2006 2:14:35 AM
PHPRunner General questions
rjks author

Morning,
I have two tables acc_einheit and acc_belegung, I want to join them using master/child information and aliases.

select e.id as einheitID,

b.id,

b.einheit,

b.tag,

b.we,

b.belegt

From acc_einheit e inner join acc_belegung b on (e.id =b.einheit) where (b.tag > 20060822 && b.tag <= 20061231)


This sql statment works correctly, list and search also, however when I try to view, add or edit I become an error

Technische Information Fehlertyp 256

Fehlerbeschreibung Column: 'id' in where clause is ambiguous

URL webserver/awis/kvs/administration/einheit_suchen_view.php?editid=44433&aktart=

Fehlerdatei f:\www\awis\kvs\administration\include\dbconnection.php

Fehlerzeile 26

SQL Abfrage select e.id as einheitID, b.id, b.einheit, b.tag, b.we, b.belegt From acc_einheit e inner join acc_belegung b on (e.id =b.einheit) where ((b.tag > 20060822 && b.tag <= 20061231)) and (`id`=44433)


I can see where the problem is

and (`id`=44433),


How can I set the editid variable to use, in this case

and (`b.id`=44433)

which works in a mysqladmin test.
Is there a tutorial for phprunner in which joins and alias are explained??
Thanks in advance
Robert

J
Jane 8/23/2006

Robert,
einheitID field that comes from joined table. You need to remove it from Edit/Add pages.

Here is an article in PHPRunner help about work with joined fields:article

rjks author 8/23/2006

Robert,

einheitID field that comes from joined table. You need to remove it from Edit/Add pages.

Here is an article in PHPRunner help about work with joined fields:article


Hallo Jane,
I´m sorry but that doesn´t seem to help, I have reduced the sql to

select e.id, b.einheit, b.tag, b.we, b.belegt From acc_einheit e inner join acc_belegung b on (e.id =b.einheit) where `id`=30

but I still get the

Column: 'id' in where clause is ambiguous

error.
if I change the sql manually to

select e.id, b.einheit, b.tag, b.we, b.belegt From acc_einheit e inner join acc_belegung b on (e.id =b.einheit) where e.id=30

then the edit call works.
Where can I set the editid clause 'id = 30' to 'e.id=30'?
Robert

J
Jane 8/23/2006

Robert,
it works for me with current PHPRunner version (3.0, build 119).

I recommend you to download and install it:

http://www.asprunner.com/files/phprunner-setup.exe

Then select Default templates on the Miscellaneous tab and rebuild your project.
If error will occur please zip and send to [email=support@xlinesoft.com]support@xlinesoft.com[/email] a full set of generated PHP files, your database creation script with sample data and your project file.

I'll find what's wrong with your project running it on my test box.

rjks author 8/24/2006

Robert,

it works for me with current PHPRunner version (3.0, build 119).

I recommend you to download and install it:

http://www.asprunner.com/files/phprunner-setup.exe

Then select Default templates on the Miscellaneous tab and rebuild your project.
If error will occur please zip and send to [email=support@xlinesoft.com]support@xlinesoft.com[/email] a full set of generated PHP files, your database creation script with sample data and your project file.

I'll find what's wrong with your project running it on my test box.


Hello Jane,
thanks for the offer but as I am using a modified Template in build 118, updating to 119 will be too much work and will take too long.
I will have to stay with 118 and its bugs, I´ll find a workaround for this problem.
My next Project will be with the new version of phprunner 3.1 or 4 as the case may be when the teething problems have been sorted out.
Thanks
Robert