OUTER JOIN in Query

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

OUTER JOIN in Query

jtuchel
Hi,

I am having trouble formulating a seemingly simple Query with an outer join in Glorp.
Let's use tables COMMAND and ERRMSG as an example where a COMMAND can have 0 to 1 associated ERMMSG.

I want to query all COMMAND objects that have the word 'DATE' in either the command itself or in its ERRMSG.

so what I have so far is this:

mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE')].

This creates an INNER JOIN and therefor never returns a command that has no errormsg associated. So far, I tried:

  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: ((cmd errmsg like: '%DATE') asOuterJoin)].
  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE') beOuterJoin].

And a few variants that use q SimpleQuery and the where: and OR: methods:

So far I had no luck at all. The web doesn't provide much information on this problem.

Any hints or ideas?

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: OUTER JOIN in Query

jtuchel
Sorry, I knew I'd make mistakes in posting this.

The statement I tried is of course this:

mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg text like: '%DATE')].

errmsg is not an attribute of the COMMAND table, but a table in itself that has a text attribute...

Joachim


Am Freitag, 2. November 2018 11:51:48 UTC+1 schrieb jtuchel:
Hi,

I am having trouble formulating a seemingly simple Query with an outer join in Glorp.
Let's use tables COMMAND and ERRMSG as an example where a COMMAND can have 0 to 1 associated ERMMSG.

I want to query all COMMAND objects that have the word 'DATE' in either the command itself or in its ERRMSG.

so what I have so far is this:

mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE')].

This creates an INNER JOIN and therefor never returns a command that has no errormsg associated. So far, I tried:

  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: ((cmd errmsg like: '%DATE') asOuterJoin)].
  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE') beOuterJoin].

And a few variants that use q SimpleQuery and the where: and OR: methods:

So far I had no luck at all. The web doesn't provide much information on this problem.

Any hints or ideas?

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: OUTER JOIN in Query

Alan Knight
In reply to this post by jtuchel
To make a relationship use an outer join, just send #asOuterJoin. e.g. (cmd errMsg asOuterJoin). You can even put that into an expression that defines a mapping so it's always an outer join.

On Fri, Nov 2, 2018, 03:51 jtuchel <[hidden email]> wrote:
Hi,

I am having trouble formulating a seemingly simple Query with an outer join in Glorp.
Let's use tables COMMAND and ERRMSG as an example where a COMMAND can have 0 to 1 associated ERMMSG.

I want to query all COMMAND objects that have the word 'DATE' in either the command itself or in its ERRMSG.

so what I have so far is this:

mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE')].

This creates an INNER JOIN and therefor never returns a command that has no errormsg associated. So far, I tried:

  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: ((cmd errmsg like: '%DATE') asOuterJoin)].
  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE') beOuterJoin].

And a few variants that use q SimpleQuery and the where: and OR: methods:

So far I had no luck at all. The web doesn't provide much information on this problem.

Any hints or ideas?

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: OUTER JOIN in Query

jtuchel
Alan,

this is so ridiculously simple and obvious that I can hardly believe I haven't tried this variant... So the correct and working statement is this:

mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg asOuterJoin text like: '%DATE')].


I just write it down again to make it easier to find next time I am at this point - and maybe for others....

As always, thanks a million for your support!


Joachim

(how do you memoize all that stuff so many years after leaving Smalltalk...???)



Am Freitag, 2. November 2018 15:50:01 UTC+1 schrieb alan.knight:
To make a relationship use an outer join, just send #asOuterJoin. e.g. (cmd errMsg asOuterJoin). You can even put that into an expression that defines a mapping so it's always an outer join.

On Fri, Nov 2, 2018, 03:51 jtuchel <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="uK5EoCVGAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jtu...@...> wrote:
Hi,

I am having trouble formulating a seemingly simple Query with an outer join in Glorp.
Let's use tables COMMAND and ERRMSG as an example where a COMMAND can have 0 to 1 associated ERMMSG.

I want to query all COMMAND objects that have the word 'DATE' in either the command itself or in its ERRMSG.

so what I have so far is this:

mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE')].

This creates an INNER JOIN and therefor never returns a command that has no errormsg associated. So far, I tried:

  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: ((cmd errmsg like: '%DATE') asOuterJoin)].
  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE') beOuterJoin].

And a few variants that use q SimpleQuery and the where: and OR: methods:

So far I had no luck at all. The web doesn't provide much information on this problem.

Any hints or ideas?

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="uK5EoCVGAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">glorp-group...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="uK5EoCVGAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">glorp...@....
Visit this group at <a href="https://groups.google.com/group/glorp-group" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/glorp-group&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/glorp-group&#39;;return true;">https://groups.google.com/group/glorp-group.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: OUTER JOIN in Query

Alan Knight
You're most welcome. Actually, it took me an embarassingly long time to remember. I knew it was possible, but I was on a tablet and couldn't run an image, so I had to look around in old presentations/documents on my drive. And I had an idea that maybe it was complicated, but the complicated thing is subselects.

On Fri, Nov 2, 2018, 08:01 jtuchel <[hidden email]> wrote:
Alan,

this is so ridiculously simple and obvious that I can hardly believe I haven't tried this variant... So the correct and working statement is this:

mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg asOuterJoin text like: '%DATE')].


I just write it down again to make it easier to find next time I am at this point - and maybe for others....

As always, thanks a million for your support!


Joachim

(how do you memoize all that stuff so many years after leaving Smalltalk...???)



Am Freitag, 2. November 2018 15:50:01 UTC+1 schrieb alan.knight:
To make a relationship use an outer join, just send #asOuterJoin. e.g. (cmd errMsg asOuterJoin). You can even put that into an expression that defines a mapping so it's always an outer join.

On Fri, Nov 2, 2018, 03:51 jtuchel <[hidden email]> wrote:
Hi,

I am having trouble formulating a seemingly simple Query with an outer join in Glorp.
Let's use tables COMMAND and ERRMSG as an example where a COMMAND can have 0 to 1 associated ERMMSG.

I want to query all COMMAND objects that have the word 'DATE' in either the command itself or in its ERRMSG.

so what I have so far is this:

mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE')].

This creates an INNER JOIN and therefor never returns a command that has no errormsg associated. So far, I tried:

  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: ((cmd errmsg like: '%DATE') asOuterJoin)].
  • mySesson read: COMMAND where: [:cmd| cmd text like: '%DATE%' OR: (cmd errmsg like: '%DATE') beOuterJoin].

And a few variants that use q SimpleQuery and the where: and OR: methods:

So far I had no luck at all. The web doesn't provide much information on this problem.

Any hints or ideas?

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.