Page 1 of 1

Sorting a table from SQL statement

PostPosted: Thu Jul 26, 2007 3:37 pm
by carlos torres
Hi

I made a query as
Code: Select all
SetVar "[strSQL]" "select * from student where Group= [#34][grp][#34] ORDER BY [#34]LastName=ASC[#34]"
dbpExecSQL "Db" "[strSQL]" "Temp1"
...///dbp accept also this sintax
...///SetVar "[strSQL]" "select * from student where Group= [#34][grp][#34] ORDER BY [#34]db.rsstudent.LastName=ASC[#34]"

It works but the temporal table is not sorted, after that I had to use
Code: Select all
dbpSort "Db" "temp1" "LastName=ASC"

to see it sorted by last names

My questions are:
- is there a bug on dbp w/ the sql statetment?
- i'm doing something wrong?

Regards

Carlos t

PostPosted: Thu Jul 26, 2007 4:08 pm
by Gaev
Carlos t:

Instead of LastName=ASC try LastName ASC.

PostPosted: Sat Jul 28, 2007 3:36 am
by christian
... you only have to use "order by" without ASC. By the way: There is a different behaviour of sorting fields using MS SQL-Server 2005 versus postgreSQL, especialy using capital letters like "Meier", "meier", strange, test it. For that reason we are testing our programs on both SQL-databases. There are a lot of other "small" differences, one belongs to date, time (MS don't know them!) and datetime.
What type of SQL-Server do you use?
Christian