On Fri, 11 Mar 2016 09:05:27 +0200, R Smith wrote:
>
>On 2016/03/11 5:52 AM, Stephen Chrzanowski wrote:
>> On Thu, Mar 10, 2016 at 2:16 PM, R Smith wrote:
>>
>>
>>> I do this kind of thing so often when filling a selection box for instance:
>>>SELECT 'None'
>>> UNION ALL
>>>SELECT City F
On 2016/03/11 5:52 AM, Stephen Chrzanowski wrote:
> On Thu, Mar 10, 2016 at 2:16 PM, R Smith wrote:
>
>
>> I do this kind of thing so often when filling a selection box for instance:
>>SELECT 'None'
>> UNION ALL
>>SELECT City FROM Countrylist WHERE Country = :1
>> UNION ALL
>> SELECT Cit
On Thu, Mar 10, 2016 at 2:16 PM, R Smith wrote:
>
> I do this kind of thing so often when filling a selection box for instance:
> SELECT 'None'
> UNION ALL
> SELECT City FROM Countrylist WHERE Country = :1
> UNION ALL
> SELECT City FROM Countrylist WHERE Country <> :1 ORDER BY City
>
> Which
On 03/10/16 20:16, R Smith wrote:
>> Hmm, does this work any better?
>>
>> SELECT id FROM t
>> ORDER BY id < 'pen' desc, id;
>
> It works, but not better.
Indeed. Any operation in ORDER BY (even things like "ORDER BY id||''")
result in scan + temp b-tree.
Thanks again.
-- Alberto
On 2016/03/10 8:37 PM, James K. Lowden wrote:
> On Thu, 10 Mar 2016 10:17:57 +0100
> Alberto Wu wrote:
>
>> On 03/09/16 23:30, James K. Lowden wrote:
SELECT P.id FROM (
SELECT 0 AS sect, id FROM t WHERE id >= 'pen'
UNION ALL
SELECT 1, id FROM t WHERE id < 'pen'
On Thu, 10 Mar 2016 21:16:28 +0200
R Smith wrote:
> > Hmm, does this work any better?
> >
> > SELECT id FROM t
> > ORDER BY id < 'pen' desc, id;
>
> It works, but not better. I think it was Igor who proposed similar
> (if not, apologies) which of course produces the correct result, but
>
On Thu, 10 Mar 2016 10:17:57 +0100
Alberto Wu wrote:
> On 03/09/16 23:30, James K. Lowden wrote:
> >> SELECT P.id FROM (
> >> SELECT 0 AS sect, id FROM t WHERE id >= 'pen'
> >> UNION ALL
> >> SELECT 1, id FROM t WHERE id < 'pen'
> >> ) AS P
> >> ORDER BY P.sect, P.id
> >> ;
> >
> > T
On 03/09/16 23:30, James K. Lowden wrote:
>> SELECT P.id FROM (
>> SELECT 0 AS sect, id FROM t WHERE id >= 'pen'
>> UNION ALL
>> SELECT 1, id FROM t WHERE id < 'pen'
>> ) AS P
>> ORDER BY P.sect, P.id
>> ;
>
> This is the correct answer.
Hi,
unfortunately the correct answer comes w
On 2016/03/09 8:08 PM, Alberto Wu wrote:
> On 03/09/16 17:26, R Smith wrote:
>> Firstly, this is the best method - one I would use. UNION ALL is quite
>> efficient.
>> Secondly, the order by will be honoured - you can refer to the SQL
>> standard for that even, it's an axiom of the output and pr
On 03/09/16 17:26, R Smith wrote:
> Firstly, this is the best method - one I would use. UNION ALL is quite
> efficient.
> Secondly, the order by will be honoured - you can refer to the SQL
> standard for that even, it's an axiom of the output and probably not
> even considered "needed" to mention.
On 2016/03/09 6:07 PM, Alberto Wu wrote:
> Hi all,
>
> I'm looking for suggestions...
> What I want to achieve is to "roll" the result set of a query around by
> a certain amount (as in offset + wrap around).
>
> For example, given that:
> CREATE TABLE t (id TEXT NOT NULL PRIMARY KEY);
> INSERT I
On Wed, 9 Mar 2016 20:43:14 +0200
R Smith wrote:
> SELECT P.id FROM (
> SELECT 0 AS sect, id FROM t WHERE id >= 'pen'
> UNION ALL
> SELECT 1, id FROM t WHERE id < 'pen'
> ) AS P
> ORDER BY P.sect, P.id
> ;
This is the correct answer.
I'm not sure what you meant by "axiom" in your
Hi all,
I'm looking for suggestions...
What I want to achieve is to "roll" the result set of a query around by
a certain amount (as in offset + wrap around).
For example, given that:
CREATE TABLE t (id TEXT NOT NULL PRIMARY KEY);
INSERT INTO t VALUES ('pen'), ('tree'), ('desk'), ('car');
I would
13 matches
Mail list logo