Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 6B43A633D02 for ; Sat, 9 Jan 2010 18:52:29 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 07085-02-8 for ; Sat, 9 Jan 2010 22:52:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from forward14.mail.yandex.net (forward14.mail.yandex.net [95.108.130.92]) by mail.postgresql.org (Postfix) with ESMTP id 8D4AA633C90 for ; Sat, 9 Jan 2010 18:52:03 -0400 (AST) Received: from webmail108.yandex.ru (webmail108.yandex.ru [95.108.130.9]) by forward14.mail.yandex.net (Yandex) with ESMTP id 53AD02680BAF; Sun, 10 Jan 2010 01:52:01 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by webmail108.yandex.ru (Yandex) with ESMTP id 461DA1974283; Sun, 10 Jan 2010 01:52:01 +0300 (MSK) X-Yandex-Spam: 1 X-Yandex-Front: webmail108 X-Yandex-TimeMark: 1263077521 Received: from user-25.81.118.217.in-addr.arpa (user-25.81.118.217.in-addr.arpa [217.118.81.25]) by mail.yandex.ru with HTTP; Sun, 10 Jan 2010 01:52:00 +0300 From: msi77 To: Wes James ,pgsql-sql@postgresql.org In-Reply-To: <533df7fa1001091018v40f02b7cxf8eb631794605aee@mail.gmail.com> References: <533df7fa1001082026h53b5d897x2fc1fa2a6f7ff6df@mail.gmail.com> <8071263036994@webmail102.yandex.ru> <533df7fa1001091018v40f02b7cxf8eb631794605aee@mail.gmail.com> Subject: Re: how to do this query MIME-Version: 1.0 Message-Id: <18301263077520@webmail108.yandex.ru> Date: Sun, 10 Jan 2010 01:52:00 +0300 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.448 tagged_above=-10 required=5 tests=BAYES_20=-0.74, FH_DATE_PAST_20XX=3.188 X-Spam-Level: ** X-Archive-Number: 201001/14 X-Sequence-Number: 33550 > schols_seleced like '%' || short_name || '%' doesn't make sense to me select 'Ya-Ya' from (select 'schol1:schol2:schol3' as schols_selects ) AS X where schols_selects like '%schol2%' > If you look at the contents of these fields short name containts > "schol1", schols_selects containts "schol1:schol2:schol3" so > schols_seleced like '%' || short_name || '%' doesn't make sense to me > since the like operator is trying to find text1 in text two with %% > right? > 2010/1/9 msi77 : > > Развернуть > > How about > > > > schols_selected like '%' || short_name || '%' > > > Развернуть > > > I have two tables: > > > students > > > stu_name > > > schols_selected > > > scholarships > > > schol_name > > > short_name > > > schols_selected is made up of scholarships the students have selected, > > > the field content will look like schol1:schol2:schol3 > > > I need a select that does something like this > > > select schol_name, short_name, stu_name, schols_selected > > > from scholarships, students > > > where short_name is in schols_selected > > > I have tried: > > > where short_name like '%' || schols_selected || '%' > > > but i'm not sure how to include a field result in between like operators. > > > how do I get a list of scholarships based one which student selected > > > it where the selected result is a string of colon seperated options? > > > thx, > > > -wj > > > -- > > > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > > > To make changes to your subscription: > > > http://www.postgresql.org/mailpref/pgsql-sql > > Здесь спама нет http://mail.yandex.ru/nospam/sign > Здесь спама нет http://mail.yandex.ru/nospam/sign