DB:exec function question

Mvqm4UP.jpg

I have a DB like this. I want it to sort it by touchCount (DESC) and add it to a tableView.

I tried doing

db:exec[[SELECT touchCount FROM Fakes ORDER BY touchCount DESC]] 

this only worked in my SQLite Viewer. I want it to sort it and add it my table. Any Ideas For this Would be really thankful!

The part for insertRow is like this.

 for row in db:nrows("SELECT \* FROM Fakes") do rowParams = { ID = row.id, Name = row.Name, Address = row.Address, Facebook = row.Facebook, } tableView:insertRow( { rowHeight = 120, params = rowParams, } ) end

Something like this:

[lua]

local q =  [[SELECT * FROM Fakes ORDER BY touchCount DESC]]

for row in db:nrows(q) do

–etc etc

[/lua]

Something like this:

[lua]

local q =  [[SELECT * FROM Fakes ORDER BY touchCount DESC]]

for row in db:nrows(q) do

–etc etc

[/lua]