[Ur] left join on same table?

Adam Chlipala adamc at impredicative.com
Sat Dec 11 20:05:42 EST 2010


Marc Weber wrote:
> I tried copy pasting the example from the demos to try whether ur
> supports join on the same table:
>
>    xml<- queryX (SELECT a.Id, a.A, b.Id, b.A FROM t1 as a LEFT JOIN t1 as b ON (a.id = b.id))
>                (fn r =>  <xml>
>                </xml>)
>
> It seems it does not - I get messages that a (the alias name) is an
> unkown table.
>
> So is the only way generating such joins by using views ?
>    

It's a much simpler problem than that.  The local table names bound by 
'AS' clauses are constructors of kind [Name], which means that they must 
begin with capital letters.  (The 'AS A' syntax is shorthand for some Ur 
combinator application with an argument [#A].)  Just change [a] and [b] 
to [A] and [B] and I think you'll see it working just as you expect.



More information about the Ur mailing list