CouchDB view to SQL Table