<div dir="ltr">By that you mean current behavior? You'd get current behavior by explicitly specifying the appropriate "by" (i.e. "by" equal to the key).<div><br></div><div style>Btw, I'm trying to understand SQL CROSS APPLY vs JOIN using <a href="http://explainextended.com/2009/07/16/inner-join-vs-cross-apply/">http://explainextended.com/2009/07/16/inner-join-vs-cross-apply/</a>, and I can't figure out how by-without-by (or with by-with-by for that matter:) ) helps with e.g. the first example there:</div>
<div style><br></div><div style>"<span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px">We table</span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px"> </span><code style="font-size:13px;line-height:18px;padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)">table1</code><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px"> </span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px">and</span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px"> </span><code style="font-size:13px;line-height:18px;padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)">table2</code><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px">.</span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px"> </span><code style="font-size:13px;line-height:18px;padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)">table1</code><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px"> </span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px">has a</span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px"> </span><code style="font-size:13px;line-height:18px;padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)">column</code><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px"> </span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px">called</span><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px"> </span><code style="font-size:13px;line-height:18px;padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)">rowcount</code><span style="font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px;line-height:18px">.</span></div>
<p style="padding:0px;margin:0px 0px 15px;line-height:18px;font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px">For each row from <code style="padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)">table1</code> we need to select first <code style="padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)">rowcount</code> rows from <code style="padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)">table2</code>, ordered by <code style="padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)"><a href="http://table2.id">table2.id</a>"</code></p>
<p style="padding:0px;margin:0px 0px 15px;line-height:18px;font-family:'Lucida Grande','Lucida Sans Unicode',Helvetica,Arial,sans-serif;font-size:13px"><code style="padding:0px;margin:0px;font-weight:bold;color:rgb(68,136,187)"><br>
</code></p></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 24, 2013 at 4:01 PM, Matthew Dowle <span dir="ltr"><<a href="mailto:mdowle@mdowle.plus.com" target="_blank">mdowle@mdowle.plus.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">But then what would be analogous to CROSS APPLY in SQL?<br>
<div class="im"><br>
> I'd agree with Eduard, although it's probably too late to change behavior<br>
> now. Maybe for data.table.2? Eduard's proposal seems more closely<br>
> aligned with SQL behavior as well (SELECT/JOIN, then GROUP, but only if<br>
> requested).<br>
><br>
> S.<br>
><br>
>> Date: Mon, 22 Apr 2013 08:17:59 -0700<br>
</div>>> From: <a href="mailto:eduard.antonyan@gmail.com">eduard.antonyan@gmail.com</a><br>
>> To: <a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
<div class="im">>> Subject: Re: [datatable-help] changing data.table by-without-by<br>
>> syntax to require a "by"<br>
>><br>
>> I think you're missing the point Michael. Just because it's possible to<br>
>> do it<br>
>> the way it's done now, doesn't mean that's the best way, as I've tried<br>
>> to<br>
>> argue in the OP. I don't think you've addressed the issue of unnecessary<br>
>> complexity pointed out in OP.<br>
>><br>
>><br>
>><br>
>> --<br>
>> View this message in context:<br>
>> <a href="http://r.789695.n4.nabble.com/changing-data-table-by-without-by-syntax-to-require-a-by-tp4664770p4664990.html" target="_blank">http://r.789695.n4.nabble.com/changing-data-table-by-without-by-syntax-to-require-a-by-tp4664770p4664990.html</a><br>
>> Sent from the datatable-help mailing list archive at Nabble.com.<br>
>> _______________________________________________<br>
>> datatable-help mailing list<br>
</div>>> <a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
<div class="im">>> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
> _______________________________________________<br>
> datatable-help mailing list<br>
</div>> <a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
<br>
<br>
</blockquote></div><br></div>