1

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'

Martheli
  • 931
  • 1
  • 16
  • 35

1 Answers1

0

You should be using db.scalar

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

Stephen
  • 1,427
  • 1
  • 17
  • 42