Reputation: 4311
Simple question. I have a table Person. I have in it two rows:
1 Joe Doe [email protected]
2 Vivien Doe [email protected]
How to write a SOCI statement, which will tell me (return) how many rows I have in my table? (Here, in my example, I have 2 rows).
Upvotes: 1
Views: 792
Reputation: 13451
To get the number of rows in an SQL table use the count(*)
function like this:
select count(*) from Person
To be more specific - to get the number into C++ variable use:
int count;
sql << "select count(*) from person", into(count);
Upvotes: 3