quick sql help

Ivan Smahin IvanSmahin at public.kherson.ua
Sun Jul 3 23:05:51 CDT 2005


Hello Robert,


Robert Nichols wrote:
> I have a cursor that has two fields (from different tables) that  share 
> the same name.
> 
> Is the strategy here to give one (or both) an alias name in my select  
> statement? That way, when getting values from the cursor I can use  one 
> or both alias names, which are not duplicated.
> 
 > If so, what is the sql syntax to create the alias name?

Certainly. The same names could be source of many problems.
So it is always good idea to get unique-field-named cursor.

SELECT t1.f1 as 't1f1', t2.f1 as 't2f1' FROM t1, t2 ...


> 
> Is there another strategy?
> 

You could get uniqueness field names using table name as prefix:

CREATE TABLE t1 ( t1_f1 LONG ) ...


-- 
Best regards,
Ivan Smahin


More information about the Valentina mailing list