On Thu, Jan 16, 2014 at 8:47 AM, Igor Tandetnik <i...@tandetnik.org> wrote:
> On 1/16/2014 5:21 AM, Rob Golsteijn wrote: > >> SELECT * FROM C >> LEFT JOIN A ON A.a*A.a + B.b*B.b = C.c*c.c >> LEFT JOIN B ON A.a*A.a + B.b*B.b = C.c*c.c; >> > > I'm not sure how SQLite interprets this query. In any case, it doesn't > make much sense. I suspect you are looking for something like this: > > SELECT * FROM A, B, C > WHERE A.a*A.a + B.b*B.b = C.c*C.c; > > -- > Igor Tandetnik > org:8080/cgi-bin/mailman/listinfo/sqlite-users<http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users> > The example did not include any rows with a NULL in them, but if that is a possibility, the OP might want: SELECT * FROM A,B,C WHERE IFNULL(A.a*A*a,0)+IFNULL(B.b*B*b,0) = C.c*C.c; So that a row such as A.a=NULL, B.b=1, and C.c=1 would be displayed. Without the IFNULL, I think that NULL+1 would equal NULL, not 1. I don't know if the OP wants this type of row or now. I would guess that he does because I think that was his reason for trying a LEFT JOIN. -- Wasn't there something about a PASCAL programmer knowing the value of everything and the Wirth of nothing? Maranatha! <>< John McKown _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users