Re: convert query from mysql

From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Mike Andrewjeski <Mike(dot)Andrewjeski(at)businesswire(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: convert query from mysql
Date: 2014-01-04 05:08:34
Message-ID: CAJKUy5jyhHcp-MAt4MGZSp0iDTa7C-uafc=1-hZvdxR4qmBQTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, Dec 17, 2013 at 3:44 PM, Mike Andrewjeski
<Mike(dot)Andrewjeski(at)businesswire(dot)com> wrote:
>
> Hi all,
>
> psql newbie here. I'm working to convert a mysql query written in ruby to
> using postgres as our database is now postgres 9.2
>
> Here's the mysql query:
>
> select nodes.name, GROUP_CONCAT(node_groups.name) from node_groups,
> node_group_memberships, nodes where nodes.id =
> node_group_memberships.node_id and node_groups.id =
> node_group_memberships.node_group_id and nodes.name IN (SELECT name
> from nodes) group by nodes.name order by nodes.name")
> What I'm having an issue with is the IN Clause. Not sure how to do that in
> psql.
>

Hi,

I was looking at this and i admit i don't understand how that IN could
ever be false (which could be caused by the beer i just drank).
The reason i don't understand it is that you are checking if the names
in table nodes exists in the table nodes :S

--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación
Phone: +593 4 5107566 Cell: +593 987171157

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Sameer Kumar 2014-01-04 11:13:52 Re: convert query from mysql
Previous Message Michael Swierczek 2014-01-03 21:39:50 Re: How to connect to a database psql doesn't see