Bug 38340 - RowNo in select BASE
Summary: RowNo in select BASE
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.5.0 Beta2
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-15 03:10 UTC by Stefan Lindel
Modified: 2012-07-27 12:31 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Lindel 2011-06-15 03:10:25 UTC
I want to use a query to add rowno in a selection:

select (Select Sum(1) from orte O where O.ID<OT.ID), * from orte OT

but i get an Error from the sql-Statement
Comment 1 Alex Thurgood 2011-06-15 08:16:53 UTC
Hi,

How exactly are you passing this SQL statement ? If you are using the built-in SQL parser, certain queries do not work e.g. functions other than aggregates, group by, order by, sum, etc. The only way to get these to work is to turn off the LibO SQL parser.


In general, you should also clearly identify your table names, e.g. "dbname"."table1" and surround them in double quotes. Sometimes, the LibO parser does get this wrong (there is a OpenOffice.org bug report for that somewhere).


Alex
Comment 2 Alex Thurgood 2011-06-15 08:18:40 UTC
I will not consider this as a valid bug report until I have more detailed information on how to reproduce the behaviour, with a sample ODB file containing the query and table for example.


Alex
Comment 3 Björn Michaelsen 2011-12-23 12:27:41 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 4 Björn Michaelsen 2011-12-23 16:59:50 UTC
needinfo keyword redundant by needinfo status.
Comment 5 Stefan Lindel 2011-12-26 01:25:59 UTC
I testet under 3.5 beta2

and the error is the same
Comment 6 Julien Nabet 2012-02-25 06:32:11 UTC
Stephan:
- did you try to reproduce this problem on a brand new document with 3.5.0 ? (with, if possible, brand new LO profile)
- could you attach the file and give the details suggested by Alexander ?

It may help a lot to understand the cause of the problem since we could try on Linux or Mac and see if there are error/warn messages.
Comment 7 Alex Thurgood 2012-02-26 22:41:01 UTC
Hi Stefan,


Without the table structure being used, the type of db, and some sample data, it is impossible to tell whether the problem is a parser one linked to the use of ALIASes, misinterpretation of 0 (zero) as INT/VARCHAR, or some failure to support the specific SQL instruction (e.g. sub-selects). 


Without further info, I will close this bug as invalid.

Alex
Comment 8 Alex Thurgood 2012-02-26 22:44:29 UTC
(In reply to comment #0)
> I want to use a query to add rowno in a selection:
> 
> select (Select Sum(1) from orte O where O.ID<OT.ID), * from orte OT
> 
> but i get an Error from the sql-Statement


Hallo Stefan,
A bisserl mehr Infos könnten wir gut gebrauchen...


Alex
Comment 9 Stefan Lindel 2012-02-26 23:12:55 UTC
Am 27.02.2012 07:44, schrieb bugzilla-daemon@freedesktop.org:
> https://bugs.freedesktop.org/show_bug.cgi?id=38340
>
> --- Comment #8 from Alex Thurgood<iplaw67@yahoo.co.uk>  2012-02-26 22:44:29 PST ---
> (In reply to comment #0)
>> I want to use a query to add rowno in a selection:
>>
>> select (Select Sum(1) from orte O where O.ID<OT.ID), * from orte OT
>>
>> but i get an Error from the sql-Statement
>
> Hallo Stefan,
> A bisserl mehr Infos könnten wir gut gebrauchen...
>
>
> Alex
>
In base kann man keinen Befehl schreiben, der einen pro Zeile die 
Zeilennummer ausgibt, dieses ist für Listen sehr hilfreich
Comment 10 Alex Thurgood 2012-02-26 23:40:07 UTC
(In reply to comment #9)

> >
> In base kann man keinen Befehl schreiben, der einen pro Zeile die 
> Zeilennummer ausgibt, dieses ist für Listen sehr hilfreich

Translation :
In Base it is not possible to write a (SQL) statement that gives a line number per returned tuple, which is very useful for lists.

So Stefan, if I understand what you want :

1  string1
2  string2
3  string 3
4  string 4
etc, etc ??

But that still doesn't explain your SQL statement - which database have you been using where a statement like the one you have given works. At least, that would tell us which dialect of SQL you are using ?

Alex
Comment 11 Alex Thurgood 2012-02-26 23:45:10 UTC
(In reply to comment #10)
> (In reply to comment #9)
> 
> > >
> > In base kann man keinen Befehl schreiben, der einen pro Zeile die 
> > Zeilennummer ausgibt, dieses ist für Listen sehr hilfreich
> 
> Translation :
> In Base it is not possible to write a (SQL) statement that gives a line number
> per returned tuple, which is very useful for lists.
> 
> So Stefan, if I understand what you want :
> 
> 1  string1
> 2  string2
> 3  string 3
> 4  string 4
> etc, etc ??
> 

I would add that I don't understand why a simple autoincrement primary key field wouldn't solve the problem. All you would need then is a SELECT ALL. Sorry, but your problem is too vague and I don't see anyway to reproduce the buggy behaviour you claim exists without trying to guess what it is exactly you have started with, and what you are trying to achieve.


Alex
Comment 12 Jochen 2012-07-26 19:28:22 UTC
Hi Stefan,

Please answer the questions. Otherwise this bugreport will be closed. Alternatively ask your question on a mailing list or in a forum
Comment 13 Stefan Lindel 2012-07-27 06:44:37 UTC
I found a other solution so you can close this thread