Subject Re: [firebird-support] Re: "First N" ignored within subselect???
Author Kjell Rilbe
Joe wrote:
> --- In firebird-support@yahoogroups.com
> <mailto:firebird-support%40yahoogroups.com>, Helen Borrie <helebor@...>
> Our application allows the users to write "ad hoc" queries against
> certain tables in the database, the results of which go into a
> fixed-structure dataset that they can scroll through, and on which the
> application will also later perform other functions. However, in order
> to make sure that the user selects the correct columns (otherwise it
> would mess up other later program logic), we hard-code the beginning of
> the query as:
>
> select (field list) from (tablename)
>
> We had a user who wanted to do a "first n" query. However, since the
> "first n" part has to go in the middle of the hard-coded part of the
> query, they couldn't do it. I was going to suggest something like my
> example as a workaround, until I found out when I tested it that it
> didn't work :-(.

In that case I'd just have a textbox to let the user enter the where
clause, and a separate spinbutton or something to select the (max) count
of rows to return (0 = return all or a checkbox that can enable/disable
the row count restriction). If you do that, it would be easy to code the
SQL generation to insert the first N after select when needed.

Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64