SneakOnYou
SneakOnYou
KKysely
Created by SneakOnYou on 9/8/2024 in #help
Unable to use table name with 3 dots in selectFrom
is there a work around available ?
5 replies
KKysely
Created by SneakOnYou on 7/16/2024 in #help
New dialect for snowflake - quotes and case sensitivity
create a plugin ?
9 replies
KKysely
Created by SneakOnYou on 7/16/2024 in #help
New dialect for snowflake - quotes and case sensitivity
what should I do then ?
9 replies
KKysely
Created by SneakOnYou on 7/16/2024 in #help
New dialect for snowflake - quotes and case sensitivity
what if I want to change the casing
9 replies
KKysely
Created by SneakOnYou on 1/24/2024 in #help
full join "using" list of columns
is there any way of using "using" @koskimas ?
19 replies
KKysely
Created by SneakOnYou on 1/24/2024 in #help
full join "using" list of columns
can I do raw sql inside the join ?
19 replies
KKysely
Created by SneakOnYou on 1/24/2024 in #help
full join "using" list of columns
you get different results
19 replies
KKysely
Created by SneakOnYou on 1/24/2024 in #help
full join "using" list of columns
try this
19 replies
KKysely
Created by SneakOnYou on 1/24/2024 in #help
full join "using" list of columns
WITH result1(amount, src__id, period) AS (VALUES (76000, '006anGu2H5ygdjh5cK', 'FY2023-Q2'),
(353000, '006bkoWWx3f7XK4kre', 'FY2023-Q3')),
result2(amount, src__id, period) AS (VALUES (353000, '006bkoWWx3f7XK4kre', 'FY2023-Q2'),
(320000, '006EAvTFuCNbXs8vfV', 'FY2023-Q2')),
result3(amount, src__id, period) AS (VALUES (353000, '006bkoWWx3f7XK4kre', 'FY2023-Q3'),
(320000, '006EAvTFuCNbXs8vfV', 'FY2023-Q2'))

SELECT COALESCE(r1.amount, 0) AS amount1,
COALESCE(r2.amount, 0) AS amount2,
COALESCE(r3.amount, 0) AS amount3,
COALESCE(r1.src__id, COALESCE(r2.src__id, r3.src__id)) AS src__id,
COALESCE(r1.period, COALESCE(r2.period, r3.period)) AS period,
0 AS placeholder_column
FROM result1 r1
full join result2 r2 using (src__id,period)
full join result3 r3 using (src__id,period)
-- LEFT JOIN result2 r2 ON r1.src__id = r2.src__id AND r1.period = r2.period
-- LEFT JOIN result3 r3 ON r1.src__id = r3.src__id AND r1.period = r3.period
WITH result1(amount, src__id, period) AS (VALUES (76000, '006anGu2H5ygdjh5cK', 'FY2023-Q2'),
(353000, '006bkoWWx3f7XK4kre', 'FY2023-Q3')),
result2(amount, src__id, period) AS (VALUES (353000, '006bkoWWx3f7XK4kre', 'FY2023-Q2'),
(320000, '006EAvTFuCNbXs8vfV', 'FY2023-Q2')),
result3(amount, src__id, period) AS (VALUES (353000, '006bkoWWx3f7XK4kre', 'FY2023-Q3'),
(320000, '006EAvTFuCNbXs8vfV', 'FY2023-Q2'))

SELECT COALESCE(r1.amount, 0) AS amount1,
COALESCE(r2.amount, 0) AS amount2,
COALESCE(r3.amount, 0) AS amount3,
COALESCE(r1.src__id, COALESCE(r2.src__id, r3.src__id)) AS src__id,
COALESCE(r1.period, COALESCE(r2.period, r3.period)) AS period,
0 AS placeholder_column
FROM result1 r1
full join result2 r2 using (src__id,period)
full join result3 r3 using (src__id,period)
-- LEFT JOIN result2 r2 ON r1.src__id = r2.src__id AND r1.period = r2.period
-- LEFT JOIN result3 r3 ON r1.src__id = r3.src__id AND r1.period = r3.period
19 replies
KKysely
Created by SneakOnYou on 1/24/2024 in #help
full join "using" list of columns
what do you mean ?
19 replies
KKysely
Created by SneakOnYou on 1/24/2024 in #help
full join "using" list of columns
because I try to join 3 tables and it does not have the same result set
19 replies
KKysely
Created by SneakOnYou on 1/24/2024 in #help
full join "using" list of columns
so something is missing
19 replies
KKysely
Created by SneakOnYou on 1/24/2024 in #help
full join "using" list of columns
i tried it but I don't seem to get the same answer using "on" and using
19 replies
KKysely
Created by SneakOnYou on 11/6/2023 in #help
Using sql.lit
Ok thank you
8 replies
KKysely
Created by SneakOnYou on 11/6/2023 in #help
Using sql.lit
how do I use sql.lit with date ? is it possible ? because when I used it in the example above I got string instead of date
8 replies
KKysely
Created by SneakOnYou on 10/4/2023 in #help
$if with sql.raw doesn't compile
I explicitly set the type to the filterWhereQuery and it worked RawBuilder<SqlBool>
4 replies
KKysely
Created by SneakOnYou on 7/20/2023 in #help
issue with complied sql when doing + interval operation
this worked
26 replies
KKysely
Created by SneakOnYou on 7/20/2023 in #help
issue with complied sql when doing + interval operation
@koskimas I used your solution with cobination of the following:
.select((eb) => fields.map((field) => sql`${sql.raw(field.fieldSql)}`.as(`${field.fieldAlias}`)));
.select((eb) => fields.map((field) => sql`${sql.raw(field.fieldSql)}`.as(`${field.fieldAlias}`)));
26 replies
KKysely
Created by SneakOnYou on 7/20/2023 in #help
issue with complied sql when doing + interval operation
this didn't work, getting the same format as it had at the beginning with the double quotes
26 replies
KKysely
Created by SneakOnYou on 7/20/2023 in #help
issue with complied sql when doing + interval operation
my meeting was at xx:15
26 replies