1
votes

I have my query set as such:

let query = devices.count

And in order to print the results I have the following:

let results = try! db.prepare(query)

            for items in results
            {
            print (items)

            }

The output is like this: Row(columnNames: ["count(*)": 0], values: [Optional(5)])

How do I just get the values? I want to print out '5'

1
Did you get the solution? - Sumona Salma

1 Answers

0
votes

You should be using db.scalar

db.scalar("SELECT count(*) FROM devices")