Re: convert query from mysql

From: Richard Broersma <richard(dot)broersma(at)gmail(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>, Kevin Grittner <kgrittn(at)ymail(dot)com>
Subject: Re: convert query from mysql
Date: 2013-12-17 22:01:20
Message-ID: CABvLTWEP+hpAP0gAABmPf+Moh+LrSpVAt8ZQUuK5ZcUycpRSFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Here is another resource that my prove helpful to your specific needs:
http://okbob.blogspot.com/2009/08/mysql-functions-for-postgresql.html

On Tue, Dec 17, 2013 at 1:55 PM, Mike Andrewjeski <
Mike(dot)Andrewjeski(at)businesswire(dot)com> wrote:

> thank you Kevin, works a treat.
> so simple...
>
> time to buy some postgres books I reckon.
>
>
>
> >>> Kevin Grittner <kgrittn(at)ymail(dot)com> 12/17/2013 1:36 PM >>>
>
> Mike Andrewjeski <Mike(dot)Andrewjeski(at)businesswire(dot)com> wrote:
>
> > 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.
>
> That query looks fine as it is if you just replace this:
>
> GROUP_CONCAT(node_groups.name)
>
> with this:
>
> string_agg(node_groups.name, ',')
>
> If that doesn't work, please show a test case where you provide SQL
> code to create and populate the tables with minimal columns and
> rows. Show your query, explain what you think the results should
> be, and show what you are getting instead.
>
> --
> Kevin Grittner
> EDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>
> Please Note:
>
> The information in this Business Wire e-mail message, and any files
> transmitted with it, is confidential and may be legally privileged. It is
> intended only for the use of the individual(s) named above. If you are the
> intended recipient, be aware that your use of any confidential or personal
> information may be restricted by state and federal privacy laws. If you,
> the reader of this message, are not the intended recipient, you are hereby
> notified that you should not further disseminate, distribute, or forward
> this e-mail message. If you have received this e-mail in error, please
> notify the sender and delete the material from any computer.
>

--
Regards,
Richard Broersma Jr.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Gavin Flower 2013-12-17 22:08:07 Re: convert query from mysql
Previous Message Mike Andrewjeski 2013-12-17 21:55:53 Re: convert query from mysql