Subject Re: USER key word not working in fb 1.5
Author Adam
> Hi Adam,
>
> Thanks for your detailed response.
>
> You're sp_test did work on fb1.5
>
> Here is an example of my code;
>
> select *
> from users a, USERS_PROFILES b
> left join loc_office d on a.office = d.office
> where a.STOCK_PROFILE = b.PROFILE_NAME
> and a.username=user

That is a strange mix of SQL 89 and SQL 92. I will convert it all to
SQL92 to make it more readable.

select *
from users a
join USERS_PROFILES b on (a.STOCK_PROFILE = b.PROFILE_NAME)
left join loc_office d on (a.office = d.office)
where a.username=user

Does this work? If not, can you substitute user for a constant string
and see if that works. eg.

select *
from users a
join USERS_PROFILES b on (a.STOCK_PROFILE = b.PROFILE_NAME)
left join loc_office d on (a.office = d.office)
where a.username='Adam'

I see that all the joins are carefully aliased which is good. Select
* is generally a bad idea, because your program will often fall to
pieces if someone adds a new field to users etc.

Where is this code being used? If it is inside a stored procedure it
will need an into statement. If you don't specifically name the
fields, then the position may be out causing a problem. Is it
possible to have multiple loc_office records with the same 'office'
value. If so, you will get multiple rows from the select, which may
be an issue if you are using the select inside an update statement or
something along those lines.

Does the problem occur in iSQL or just in your program?