On 07/19/2015 07:20 AM, Todd Roth wrote:
Another newbie question… How do you check for equality between optional and
non-optional columns in different tables when doing join queries? The
following exampleQ query does not compile. I get the errors shown in [1]
table table2 : { Id : int, SomeVal : string}
PRIMARY KEY Id
table table1 : { Id : int, Table2Val : option int }
PRIMARY KEY Id,
CONSTRAINT Table2Val FOREIGN KEY Table2Val REFERENCES table2(Id)
fun exampleQ () = queryL (SELECT * FROM table1 LEFT JOIN table2 ON
table1.Table2Val = table2.Id)
Here's the simple fix:
fun exampleQ () = queryL (SELECT * FROM table1 LEFT JOIN table2
ON table1.Table2Val =
{sql_nullable (SQL table2.Id)})
_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur