Permalink
Browse files

documentation update

  • Loading branch information...
1 parent 43614b1 commit 577f20621bbe090898966f3ad902c52e4d45e005 @danielb2 danielb2 committed Jan 28, 2013
Showing with 19 additions and 0 deletions.
  1. +19 −0 README.md
View
@@ -48,6 +48,7 @@ Basic support of MySQL commands
* LIMIT and OFFSET
* ORDER BY
* GROUP BY
+ * COUNT
Methods
=======
@@ -204,6 +205,12 @@ Produces and executes a SELECT query.
db.get('people', function(err, rows, fields) { ... });
// This would produce: SELECT … FROM people …
+## .count(tableName, responseCallback)
+Produces and executes a SELECT query with count.
+
+ db.get('people', function(err, rows, fields) { ... });
+ // This would produce: SELECT count(*) FROM people …
+
## .query(sqlQueryString, responseCallback)
Produces and executes a raw query. Note that while no set query conditions will be used in this query, they will all be reset nevertheless with the execution.
@@ -289,6 +296,18 @@ SELECT query with custom fields, WHERE, JOIN and LIMIT
console.log(results);
});
+Basic counting
+------------------------------------------------------
+
+ db
+ .where({
+ 'people.name': 'Martin',
+ 'songs.title': 'Yesterday'
+ })
+ .count('people', function(err, results, fields) {
+ console.log(results);
+ });
+
SELECT query with custom fields and GROUP BY
--------------------------------------------

0 comments on commit 577f206

Please sign in to comment.