Board index » delphi » TQUERY-SQL-Order by...

TQUERY-SQL-Order by...

Hi,

I display records in a TDBGRID. The records are retrieved by using TQUERY.
Im tring to display the tabled sorted by a string field (using order by...) in

my sql command BUT the result is that the records are sorted first by
UPPERCASE chars and only than records with LOWERCASE chars (example: 'Bob' is
comes previous to 'ariel') !

If you know how to solve the problem please EMail me to l...@netvision.net.il

Thanks :)

        Maayan

 

Re:TQUERY-SQL-Order by...


Quote
l...@netvision.net.il wrote:

> Hi,

> I display records in a TDBGRID. The records are retrieved by using TQUERY.
> Im tring to display the tabled sorted by a string field (using order by...) in

> my sql command BUT the result is that the records are sorted first by
> UPPERCASE chars and only than records with LOWERCASE chars (example: 'Bob' is
> comes previous to 'ariel') !

I hope you have the right rdbms for this. I tested against:
- dBase: no success;
- Paradox: automatic (i.e. "order by name" does what you want. Very
nice feature);
- Interbase: no success;
- Oracle: "order by upper(name)" does what you want.

Good luck!

Jasper

PS: please take into consideration
- when replying, I just think I know;
- when asking, be sure that I don't.

Re:TQUERY-SQL-Order by...


You may also want to consider looking in the TQuery.FilterOptions...
Try setting foCaseInsensitive to TRUE. This should affect how the query
interacts with the dataset.

Hope this helps...

Jeff

Re:TQUERY-SQL-Order by...


In <NEWTNews.834122906.19947....@dialup.netvision.net.il>

Quote
l...@netvision.net.il writes:

>Hi,

>I display records in a TDBGRID. The records are retrieved by using
TQUERY.
>Im tring to display the tabled sorted by a string field (using order
by...) in

>my sql command BUT the result is that the records are sorted first by
>UPPERCASE chars and only than records with LOWERCASE chars (example:
'Bob' is
>comes previous to 'ariel') !

>If you know how to solve the problem please EMail me to

l...@netvision.net.il

Quote

>Thanks :)

>    Maayan

Use the UPPER command.  I think it's in SQLREF.hlp
Ben
Arrow

Re:TQUERY-SQL-Order by...


In <NEWTNews.834122906.19947....@dialup.netvision.net.il>

Quote
l...@netvision.net.il writes:

>Hi,

>I display records in a TDBGRID. The records are retrieved by using
TQUERY.
>Im tring to display the tabled sorted by a string field (using order
by...) in

>my sql command BUT the result is that the records are sorted first by
>UPPERCASE chars and only than records with LOWERCASE chars (example:
'Bob' is
>comes previous to 'ariel') !

>If you know how to solve the problem please EMail me to

l...@netvision.net.il

Quote

>Thanks :)

>    Maayan

Use the UPPER command.  I think it's in SQLREF.hlp
Ben
Arrow

Other Threads