Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 10984 invoked from network); 30 Oct 2009 20:47:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Oct 2009 20:47:04 -0000 Received: (qmail 89091 invoked by uid 500); 30 Oct 2009 20:47:03 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 89018 invoked by uid 500); 30 Oct 2009 20:47:02 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 89008 invoked by uid 99); 30 Oct 2009 20:47:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Oct 2009 20:47:02 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [206.190.48.133] (HELO web52210.mail.re2.yahoo.com) (206.190.48.133) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 30 Oct 2009 20:46:53 +0000 Received: (qmail 43462 invoked by uid 60001); 30 Oct 2009 20:46:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1256935591; bh=oV5lL0+OkEnQ5p8aZ4zWHfgHvawJ0hhonzkyZtbctJw=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=Rc3byj+v9NZ3KOJFvqO2VOfroqw/BKxniPq/50SsQiAG3JRN6iCRmjDMVE0bk8TSqWkRyELhszw8SSZDVMSaWZSD7TgqWverhsO+ykcyfKZs7Ld/GjjK3/Y1u4U7CHP83ZQ0o4rgFUxk/UGEVqV93zY2iwfZCMD7gEV0p994UtE= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=dOxsBdxy+vkVlHmMaV177o+qaiAV3Iikxdr+gvkE6M3sZX+gBHDz6lHC2nKymxgkM1ZX5fy6QOqaGGK2JTIi5AGM+shZNG875ZZwYXCBFXFbNUEXXxS5lKXYUL1nkzHhJUQKyHGE5JhUlZSjxunePqJiPdeSx+jt7KITQn0pL9A=; Message-ID: <949240.42364.qm@web52210.mail.re2.yahoo.com> X-YMail-OSG: J5A3BHMVM1mac1CB5RXUEh.HJYzXyy5wAET_dfCP5V7Ji0oEhpZEOAKaVoHDeHzejOgjgkLXeOOmEyahHU5PL9qtuu6pw6OO2WKHTRzel67J3I92dQdcgDUizWKJP1wCBgmjfqmVj7.aCMzQpj9RtDD5AQZnolua3S6AJutn_RgOyv0w6y.hesV7K4dhnz4yzgnFQSuuGye9ucA5C29nA9771Fi9n938UGeZLRjqyni5Q71yPxld1g9lDfXMgjNDfVQE9ZVF8CA3a8UOoWX3.VWgxGehAFdXJU_fRywUTMdj5MKWqLryUiPVOGbHTaok4.TSJloeOKFmKioGRLzyUsb8pksiYgv5iFM3ZoRETGUN8OMHPzlhLtFfOtLuxfoNair_5zulCywUShxiV1WnUceAeunYP8ryKAKux7AsUP_wYWzWvwVwnor5o0YfXp.6A5FnXnverVScfPhO.bC4IEnLy0tOexb9jXEowkcOYT2NmkkbLw-- Received: from [68.148.20.81] by web52210.mail.re2.yahoo.com via HTTP; Fri, 30 Oct 2009 13:46:31 PDT X-Mailer: YahooMailClassic/7.0.14 YahooMailWebService/0.7.361.4 Date: Fri, 30 Oct 2009 13:46:31 -0700 (PDT) From: Duy Nguyen Subject: Re: CouchDB equivalent dynamic SQL To: user@couchdb.apache.org In-Reply-To: <415EAAEA-4699-4AA2-8368-E8FF6E305750@apache.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-370998442-1256935591=:42364" X-Virus-Checked: Checked by ClamAV on apache.org --0-370998442-1256935591=:42364 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for reply , guys. If i want to select all tv or computer that have p= rice in between 1000 and 2000,=A0 ?startkey=3D [ ["computer", "tv"] , 1000]&endkey=3D[["computer", "tv"]=A0, = 2000]&include_docs=3Dtrue Is it correct ? --- On Sat, 10/31/09, Adam Kocoloski wrote: From: Adam Kocoloski Subject: Re: CouchDB equivalent dynamic SQL To: user@couchdb.apache.org Date: Saturday, October 31, 2009, 12:59 AM On Oct 30, 2009, at 1:36 PM, Duy Nguyen wrote: > Hi guys, > I have a troublesome sql query that needs to translate to couchDB map/red= uce > SELECT * FROM PRODUCTSWHERE [ PRICE ] AND [TYPE]' > Please note that Price and Type are dynamically generated depend on user = inputs. ( i.e TYPEcan be 100 < PRICE < 1000, or 1 < PRICE < 100, or 1000 < = PRICE < 10000. TYPE could be 'computer' , 'tv' etc..) > I can not do dynamically query on the fly with CouchDB. what is the best = way to solve this problem ? Hi Duy, it won't always be a perfect translation.=A0 But CouchDB's compound= view keys should be able to help you in this situation.=A0 In your map, em= it([doc.type, doc.price], null) and then query the view with ?startkey=3D["computer", 1000]&endkey=3D["computer", 10000]&include_docs=3D= true or ?startkey=3D["tv", 100]&endkey=3D["tv", 1000]&include_docs=3Dtrue Best, Adam =0A=0A=0A --0-370998442-1256935591=:42364--