Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X metaop #403

Open
FCO opened this issue Nov 1, 2019 · 3 comments
Open

X metaop #403

FCO opened this issue Nov 1, 2019 · 3 comments
Labels
question Further information is requested

Comments

@FCO
Copy link
Owner

FCO commented Nov 1, 2019

(Model1.^all X Model2.^all).grep: { .[0].col1 == .[1].col2 }

should it do something like this?

SELECT
   table1.*, table2.*
FROM
   table1 as t1
   JOIN table2 as t2 ON t1.col1 = t2.col2
@FCO
Copy link
Owner Author

FCO commented Nov 1, 2019

maybe it could be the solution for #345

@FCO FCO added the question Further information is requested label Nov 1, 2019
@mattlaw
Copy link

mattlaw commented Nov 1, 2019

Looks like a good solution for inner joins, but tricky to extend to outer joins.

my ($left, $right) = [1, 2, 3], [1, 2, 4];
$left.map: -> $lv { |( $lv X ($right.grep( -> $rv {$lv == $rv}) || (Nil)) ) }

--> ((1 1) (2 2) (3 Nil))

@Xliff
Copy link
Contributor

Xliff commented Nov 4, 2019

For some DBOs this might be better off as a CROSS JOIN.

https://www.w3resource.com/sql/joins/cross-join.php

So that:

   (Model1.^all X Model2.^all)

results in:

SELECT *
FROM Model1
CROSS JOIN Model2

That is the best match for the X metaop, BTW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants