Android Question Looking for SQL statement...

Cenny

Active Member
Licensed User
Longtime User
I am looking for a sql statement that gives me records where the fieldnames are in alphabetical order

Cenny
 

DonManfred

Expert
Licensed User
Longtime User
select fieldA,fieldB,[...] FROM table;
Dont use *. Add all Fields by it names and aplabetical order into the query....
There is no buildin function to get the fields ordered.
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
I don't think, that you can manage it in one step. First you have to query the fieldnames from your table. There are different sql statements in the different database systems for that, like in sqlite:
B4X:
PRAGMA table_info(mytable);
in the second step you iterate through the result of the first query and build your select statement
 
Upvote 0

Cenny

Active Member
Licensed User
Longtime User
I have solved it by extracting the fieldnames from the table, put them in a list, sorted it and used the list to build a new sql select statement.
Works fine.
Thanks for your suggestions.

Cenny
 
Upvote 0
Top