My first query...
SELECT
t1.a, t1.b, t1.c,
t2.a, t2.b, t2.c
FROM t1
LEFT JOIN t2 ON t1.a = t2.a
WHERE t1.b = '000000'
AND LENGTH(t1.a) > '5'
AND t1.c <> 'Y';
My second query...
SELECT
t1.a,
t3.b as testMe
FROM t1
LEFT JOIN t3 ON t1.a = '0' + LEFT(t3.a, 5)
WHERE t1.a = '017941';
Both of these queries work fine by themselves, but I need them combined into one result set. Worth noting is that the where
clause in the second query is there for testing purposes, but when I remove it the whole thing crashes. Not sure if that means I need something to filter by, or it's timing out? The database I'm using is Pervasive.
My failed query...
SELECT
t1.a, t1.b, t1.c,
t2.a, t2.b, t2.c,
t3.b as testMe
FROM t1
LEFT JOIN t2 ON t1.a = t2.a
LEFT JOIN t3 ON t1.a = '0' + LEFT(t3.a, 5)
WHERE t1.b = '000000'
AND LENGTH(t1.a) > '5'
AND t1.c <> 'Y';
I've shorted my code to better show what I have going on, but the actual code can be found here: http://codeshare.io/A2aB9