From andy@infocus.co.za Wed May 3 10:23:52 2006 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E54929FB261 for ; Wed, 3 May 2006 07:23:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 51557-02-5 for ; Wed, 3 May 2006 07:23:39 -0300 (ADT) X-Greylist: delayed 00:31:21.09242 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id B11BD9FB391 for ; Wed, 3 May 2006 06:56:04 -0300 (ADT) Received: from ctb-mesg8.saix.net (ctb-mesg8.saix.net [196.25.240.78]) by svr4.postgresql.org (Postfix) with ESMTP id E449B5B1656 for ; Wed, 3 May 2006 09:14:37 +0000 (GMT) Received: from [111.112.113.9] (dsl-146-176-00.telkomadsl.co.za [165.146.176.0]) by ctb-mesg8.saix.net (Postfix) with ESMTP id 6F5363125 for ; Wed, 3 May 2006 11:14:27 +0200 (SAST) Subject: Select and order by question From: Andy Dunlop To: pgsql-php@postgresql.org Content-Type: multipart/related; type="multipart/alternative"; boundary="=-sOG5NXamD3uWs9jff1xs" Organization: Infocus Date: Wed, 03 May 2006 11:13:10 +0200 Message-Id: <1146647591.7286.284.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.273 tagged_above=0 required=5 tests=BAYES_05, EXTRA_MPART_TYPE, HTML_50_60, HTML_IMAGE_ONLY_20, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200605/3 X-Sequence-Number: 3503 --=-sOG5NXamD3uWs9jff1xs Content-Type: multipart/alternative; boundary="=-Zh7ZMpfLl0g840bQSXCt" --=-Zh7ZMpfLl0g840bQSXCt Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi - I have the following code: //show table of current events needing action $sSql = "SELECT id FROM crm_leads "; $sLeads = pg_exec($conn,$sSql); for($e=0;$e Hi - I have the following code:

//show table of current events needing action
$sSql = "SELECT id FROM crm_leads ";
$sLeads = pg_exec($conn,$sSql);
for($e=0;$e<pg_numrows($sLeads);$e++){
        $sSql = "SELECT * FROM crm_events WHERE crm_leads_id = ".pg_result($sLeads,$e,"id")." AND follow_up_action!='' ORDER BY follow_up_date asc limit 1";
        $sRes = pg_exec($conn,$sSql);
        $sHits = pg_numrows($sRes);
        if($sHits!=0){
                for($i=0;$i<$sHits;$i++){
              // generate the display here
        }
}

crm_leads is a parent with many crm_events as it's children.
This code gives me the correct set of rows.
My problem is that I want only the last row from crm_events (as per limit 1) but I want those rows sorted by follow_up_date. I guess I need to have the whole query in one select statement? But how?

Any help appreciated
Thanks
Andy Dunlop

www.infocus.co.za
+27 21 532 0335 office
+27 82 770 8749 mobile
--=-Zh7ZMpfLl0g840bQSXCt-- --=-sOG5NXamD3uWs9jff1xs Content-ID: <1146646853.7286.270.camel@localhost.localdomain> Content-Disposition: attachment; filename=infocus_cropped.jpg Content-Type: image/jpeg; name=infocus_cropped.jpg Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQEAlQCVAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD//gAXQ3JlYXRlZCB3 aXRoIFRoZSBHSU1Q/9sAQwAFAwQEBAMFBAQEBQUFBgcMCAcHBwcPCwsJDBEPEhIRDxERExYcFxMU GhURERghGBodHR8fHxMXIiQiHiQcHh8e/9sAQwEFBQUHBgcOCAgOHhQRFB4eHh4eHh4eHh4eHh4e Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4e/8AAEQgAJABzAwEiAAIRAQMRAf/E AB0AAAIBBQEBAAAAAAAAAAAAAAAIBwEDBAUGAgn/xAA4EAABAwQBAwEGAgcJAAAAAAABAgMEAAUG EQcSITFBCBMiUWFxFGIyRFOBkaHBFRYkJTlSZYL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@gmail.com Wed May 3 12:45:57 2006 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 53D1E9F946D for ; Wed, 3 May 2006 09:45:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 12376-03 for ; Wed, 3 May 2006 09:45:47 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.206]) by postgresql.org (Postfix) with ESMTP id 1FD269F9586 for ; Wed, 3 May 2006 09:45:46 -0300 (ADT) Received: by nz-out-0102.google.com with SMTP id 8so161897nzo for ; Wed, 03 May 2006 05:45:45 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=BoWZAsZQ5rP1/7GHGyImUkghSrnlMTgmy+cR1W9T0NCphMysW8dXpo58Xow6f3qvovJUkOiK1dMRPjKihcL7ykLLGncCd60EdlQ3VpRtMJS2RM1OD7Pgs3NXR7zO8GgL6Dv7dwOREQo2XgTizTMBMTGECWx8aHmq94k4TTIitGo= Received: by 10.36.49.6 with SMTP id w6mr2400955nzw; Wed, 03 May 2006 05:45:45 -0700 (PDT) Received: by 10.36.97.2 with HTTP; Wed, 3 May 2006 05:45:45 -0700 (PDT) Message-ID: <3c1395330605030545r3ff1c607uf2672f963aec6257@mail.gmail.com> Date: Wed, 3 May 2006 22:45:45 +1000 From: "chris smith" To: "Andy Dunlop" Subject: Re: Select and order by question Cc: pgsql-php@postgresql.org In-Reply-To: <1146647591.7286.284.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1146647591.7286.284.camel@localhost.localdomain> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/5 X-Sequence-Number: 3505 On 5/3/06, Andy Dunlop wrote: > > Hi - I have the following code: > > //show table of current events needing action > $sSql =3D "SELECT id FROM crm_leads "; > $sLeads =3D pg_exec($conn,$sSql); > for($e=3D0;$e $sSql =3D "SELECT * FROM crm_events WHERE crm_leads_id =3D ".pg_= result($sLeads,$e,"id")." AND follow_up_action!=3D'' ORDER BY follow_up_dat= e asc limit 1"; > $sRes =3D pg_exec($conn,$sSql); > $sHits =3D pg_numrows($sRes); > if($sHits!=3D0){ > for($i=3D0;$i<$sHits;$i++){ > // generate the display here > } > } > > crm_leads is a parent with many crm_events as it's children. > This code gives me the correct set of rows. > My problem is that I want only the last row from crm_events (as per limi= t 1) but I want those rows sorted by follow_up_date. I guess I need to have= the whole query in one select statement? But how? select * from crm_leads l, crm_events e where l.id=3De.crm_leads_id and follow_up_action !=3D '' ORDER BY follow_up_date ASC LIMIT 1; Make sure crm_events crm_leads_id has an index on id and cram_leads id.. -- Postgresql & php tutorials http://www.designmagick.com/ From Sherwin_Harris@byu.edu Wed May 3 15:30:00 2006 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id AD5FA9FA226 for ; Wed, 3 May 2006 12:30:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 34386-02 for ; Wed, 3 May 2006 12:29:38 -0300 (ADT) X-Greylist: delayed 00:32:51.394189 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id D7EE89FB1C1 for ; Wed, 3 May 2006 12:29:33 -0300 (ADT) Received: from Damato.exch.ad.byu.edu (damato.byu.edu [128.187.21.129]) by svr4.postgresql.org (Postfix) with ESMTP id DBFCF5AFF0F for ; Wed, 3 May 2006 14:56:49 +0000 (GMT) Received: from klondike.exch.ad.byu.edu ([10.11.21.66]) by Damato.exch.ad.byu.edu with Microsoft SMTPSVC(6.0.3790.1830); Wed, 3 May 2006 08:56:45 -0600 x-mimeole: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/related; boundary="----_=_NextPart_001_01C66EC1.BEEE2A7F"; type="multipart/alternative" Subject: Re: Select and order by question Date: Wed, 3 May 2006 08:56:22 -0600 Message-ID: X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: [PHP] Select and order by question Thread-Index: AcZum8QSbMOdVfT9R3q52d5xgLRbiwAJW58A From: "Sherwin M. Harris" To: X-OriginalArrivalTime: 03 May 2006 14:56:45.0329 (UTC) FILETIME=[CBC86810:01C66EC1] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/6 X-Sequence-Number: 3506 This is a multi-part message in MIME format. ------_=_NextPart_001_01C66EC1.BEEE2A7F Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C66EC1.BEEE2A7F" ------_=_NextPart_002_01C66EC1.BEEE2A7F Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Assuming you are using a version of a database that can support sub-queries (MySQL 4.1 and up, Postgresql (all reasonably current versions, any other robust RDBMS) you can do the query like this: $sSql =3D "SELECT * FROM crm_events WHERE crm_leads_id IN (SELECT id = FROM crm_leads) AND follow_up_action!=3D'' ORDER BY follow_up_date asc limit = 1" Not sure what your follow_up_action !=3D" is suppose to be doing but if the rest works for you that should give you what you want. =20 =20 Sherwin Harris Web Developer Brigham Young University =20 ________________________________ From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org] On Behalf Of Andy Dunlop Sent: Wednesday, May 03, 2006 3:13 AM To: pgsql-php@postgresql.org Subject: [PHP] Select and order by question =20 Hi - I have the following code: //show table of current events needing action $sSql =3D "SELECT id FROM crm_leads "; $sLeads =3D pg_exec($conn,$sSql); for($e=3D0;$e

Assuming you are using a version of = a database that can support sub-queries (MySQL 4.1 and up, Postgresql (all reasonably current versions, any other robust RDBMS) you can do the = query like this:

$sSql =3D "SELECT * FROM crm_events WHERE crm_leads_id IN = (SELECT id FROM crm_leads) AND follow_up_action!=3D'' ORDER BY follow_up_date asc = limit 1"

Not sure what your follow_up_action !=3D” is suppose to be = doing but if the rest works for you that should give you what you = want.

 

 

Sherwin = Harris

Web = Developer

Brigham Young University

 


From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org] = On Behalf Of Andy Dunlop
Sent: Wednesday, May 03, = 2006 3:13 AM
To: = pgsql-php@postgresql.org
Subject: [PHP] Select and = order by question

 

Hi - I have the following code:

//show table of current events needing action
$sSql =3D "SELECT id FROM crm_leads ";
$sLeads =3D pg_exec($conn,$sSql);
for($e=3D0;$e<pg_numrows($sLeads);$e++){
        $sSql =3D "SELECT * FROM crm_events WHERE crm_leads_id =3D ".pg_result($sLeads,$e,"id")." AND = follow_up_action!=3D'' ORDER BY follow_up_date asc limit 1";
        $sRes =3D = pg_exec($conn,$sSql);
        $sHits =3D = pg_numrows($sRes);
        if($sHits!=3D0){
            &= nbsp;   for($i=3D0;$i<$sHits;$i++){
            &= nbsp; // generate the display here
        }
}

crm_leads is a parent with many crm_events as it's children.
This code gives me the correct set of rows.
My problem is that I want only the last row from crm_events (as per = limit 1) but I want those rows sorted by follow_up_date. I guess I need to have = the whole query in one select statement? But how?

Any help appreciated
Thanks

Andy Dunlop

www.infocus.co.za
+27 21 532 0335 office
+27 82 770 8749 mobile

 

------_=_NextPart_002_01C66EC1.BEEE2A7F-- ------_=_NextPart_001_01C66EC1.BEEE2A7F Content-Type: image/jpeg; name="image002.jpg" Content-Transfer-Encoding: base64 Content-ID: Content-Description: image002.jpg Content-Location: image002.jpg /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIf IiEmKzcvJik0KSEiMEExNDk7Pj4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kYjqJulwIOvl55z7YrrvDQ0/8A4WVqg1wQmYQJ/Z4ucbNn8WzPGaUG+pePhTUvdSVu 2x6LZa7pWo2kl3Z6jbTwRcySJICE/wB70/Gp4r22nsxeRXEUluV3iZWBQr656Yrh9T/4Rf7f4gtt HhDavLpjm4NsMxbcHAOPl3frTPDOs6Zb/BuEy30C7LCSNl3jcHww2465rQ8s7G48RaNa2Md/Pqlo lrL/AKuYyja/+6e/4U/TNc0vWVZtN1C3uwn3vKcEr9R1FeRaPZWd1oXhB4tZt7DV4raX7NHewb4J VLtnOeAf1rpPDuoyWPj5NP1LSdLOo3tuT9t0tzt2r/fTtQB3kOlWNtf3F/BaRR3V0AJ5lXDSY6ZN Lp+lWOk25t9PtY7aEuXKRjA3HqauUUAZLeGdENhJYHS7Y2s0vnSQ7PlZ853Eeuawtb8C219M8sUU bo/LROMj8K7I9KSpaTRtRrzotuD3OL0fwRBp77oLGC1Y8M6r81dDd+HNI1G0S21DT7e7jj+750Yb BrS/ip9KMUgq1ZVNyhpuiaZo8Bg02wt7SNvvLFGF3fX1qong/wAOR3b3aaJZLPICGkEIyc9a2qKs xMqTwxocumRaZLpVq9nDny4GiBVM+npT9K8PaPom7+y9MtrPf94xRgE/jWlRQB//2Q== ------_=_NextPart_001_01C66EC1.BEEE2A7F-- From operationsengineer1@yahoo.com Wed May 3 16:12:55 2006 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 79ADD9F9CC1 for ; Wed, 3 May 2006 13:12:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 29761-06 for ; Wed, 3 May 2006 13:12:45 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web33314.mail.mud.yahoo.com (web33314.mail.mud.yahoo.com [68.142.206.129]) by postgresql.org (Postfix) with SMTP id 997879F9C10 for ; Wed, 3 May 2006 13:12:44 -0300 (ADT) Received: (qmail 3547 invoked by uid 60001); 3 May 2006 16:12:43 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ojxUgSuyMEHd1O9tbqTSbRrQ0lTfFH6qH9QXmcAKgtuPreVkU5uOOAC9UwTmlE1HCaiysjPg2zWDmLryUGALedXH7KkDeeVkyf4IM1vjqDsTvtmBrYpec1akDS9hFgwJWErSDx1k9d5JsLKi6PfyWSSBgcux/7bwyqPc03JsCUk= ; Message-ID: <20060503161243.3545.qmail@web33314.mail.mud.yahoo.com> Received: from [12.9.179.126] by web33314.mail.mud.yahoo.com via HTTP; Wed, 03 May 2006 09:12:43 PDT Date: Wed, 3 May 2006 09:12:43 -0700 (PDT) From: Subject: Re: Select and order by question To: "Sherwin M. Harris" , pgsql-php@postgresql.org In-Reply-To: MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-ID: X-Archive-Number: 200605/7 X-Sequence-Number: 3507 off topic, but still relevant to php sql. i'll share something that has made my life much easier wrt sql statements - heredocs. the format looks like this: $sSql = <<<_ESQL SELECT * FROM crm_events WHERE crm_leads_id IN (SELECT id FROM crm_leads) AND follow_up_action!='' ORDER BY follow_up_date asc limit 1 _ESQL the benefits are that it is much more readable, you don't have to worry about escaping the usual suspect characters and you can easily copy and paste this code into a sql tool to test the results of the sql. you can also copy and paste from the sql tool back into your code. this helps dramatically when you have 20-30 lines of sql with quotes throughout. ;-) you can look up heredoc in the php for more information. good luck. --- "Sherwin M. Harris" wrote: > Assuming you are using a version of a database that > can support > sub-queries (MySQL 4.1 and up, Postgresql (all > reasonably current > versions, any other robust RDBMS) you can do the > query like this: > > $sSql = "SELECT * FROM crm_events WHERE crm_leads_id > IN (SELECT id FROM > crm_leads) AND follow_up_action!='' ORDER BY > follow_up_date asc limit 1" > > Not sure what your follow_up_action !=" is suppose > to be doing but if > the rest works for you that should give you what you > want. > > > > > > Sherwin Harris > > Web Developer > > Brigham Young University > > > > ________________________________ > > From: pgsql-php-owner@postgresql.org > [mailto:pgsql-php-owner@postgresql.org] On Behalf Of > Andy Dunlop > Sent: Wednesday, May 03, 2006 3:13 AM > To: pgsql-php@postgresql.org > Subject: [PHP] Select and order by question > > > > Hi - I have the following code: > > //show table of current events needing action > $sSql = "SELECT id FROM crm_leads "; > $sLeads = pg_exec($conn,$sSql); > for($e=0;$e $sSql = "SELECT * FROM crm_events WHERE > crm_leads_id = > ".pg_result($sLeads,$e,"id")." AND > follow_up_action!='' ORDER BY > follow_up_date asc limit 1"; > $sRes = pg_exec($conn,$sSql); > $sHits = pg_numrows($sRes); > if($sHits!=0){ > for($i=0;$i<$sHits;$i++){ > // generate the display here > } > } > > crm_leads is a parent with many crm_events as it's > children. > This code gives me the correct set of rows. > My problem is that I want only the last row from > crm_events (as per > limit 1) but I want those rows sorted by > follow_up_date. I guess I need > to have the whole query in one select statement? But > how? > > Any help appreciated > Thanks > > Andy Dunlop > > www.infocus.co.za > +27 21 532 0335 office > +27 82 770 8749 mobile > > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com >From pgsql-php-owner@postgresql.org Wed May 3 16:26:00 2006 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 88B7B9FA36E for ; Wed, 3 May 2006 16:26:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 58161-02 for ; Wed, 3 May 2006 16:25:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from a2s5.a2hosting.com (host-209-124-50-10.a2webhosting.com [209.124.50.10]) by postgresql.org (Postfix) with ESMTP id 3F9C39F9C1D for ; Wed, 3 May 2006 16:25:46 -0300 (ADT) Received: from adsl-153-96-23.tys.bellsouth.net ([70.153.96.23] helo=[192.168.1.10]) by a2s5.a2hosting.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.52) id 1FbMyl-0006l6-Db; Wed, 03 May 2006 15:25:43 -0400 In-Reply-To: <20060503161243.3545.qmail@web33314.mail.mud.yahoo.com> References: <20060503161243.3545.qmail@web33314.mail.mud.yahoo.com> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <1AEFEEC2-CEA4-414F-876A-D805EAB55544@pgedit.com> Cc: "Sherwin M. Harris" , pgsql-php@postgresql.org Content-Transfer-Encoding: 7bit From: John DeSoi Subject: Re: Select and order by question Date: Wed, 3 May 2006 15:25:24 -0400 To: X-Mailer: Apple Mail (2.749.3) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s5.a2hosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - pgedit.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/8 X-Sequence-Number: 3508 On May 3, 2006, at 12:12 PM, wrote: > off topic, but still relevant to php sql. i'll share > something that has made my life much easier wrt sql > statements - heredocs. > > the format looks like this: > > $sSql = <<<_ESQL > > SELECT * FROM crm_events > WHERE crm_leads_id > IN (SELECT id FROM crm_leads) > AND follow_up_action!='' > ORDER BY follow_up_date asc limit 1 > > _ESQL A little shameless promotion: pgEdit will even color the heredoc string for SQL if you start your heredoc string with <<; Wed, 10 May 2006 04:59:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 54374-08 for ; Wed, 10 May 2006 04:58:56 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 14FA59F96B6 for ; Wed, 10 May 2006 04:58:55 -0300 (ADT) Received: from ctb-mesg8.saix.net (ctb-mesg8.saix.net [196.25.240.78]) by svr4.postgresql.org (Postfix) with ESMTP id 1F7065B69A2 for ; Wed, 10 May 2006 07:58:53 +0000 (GMT) Received: from [111.112.113.9] (dsl-165-200-142.telkomadsl.co.za [165.165.200.142]) by ctb-mesg8.saix.net (Postfix) with ESMTP id DA1E34268; Wed, 10 May 2006 09:58:45 +0200 (SAST) Subject: Re: Select and order by question From: Andy Dunlop To: "Sherwin M. Harris" Cc: pgsql-php@postgresql.org In-Reply-To: References: Content-Type: multipart/related; type="multipart/alternative"; boundary="=-h4COFrQejVYZef99DnpJ" Organization: Infocus Date: Wed, 10 May 2006 09:58:14 +0200 Message-Id: <1147247895.6686.88.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/9 X-Sequence-Number: 3509 --=-h4COFrQejVYZef99DnpJ Content-Type: multipart/alternative; boundary="=-Kprzzbv1kpE5F3Fsq9dx" --=-Kprzzbv1kpE5F3Fsq9dx Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If anyone is interested, here is the code we eventually have used: ".$compName1."".$empl1."".pg_result($sRes, $i,"date")."".pg_result($sRes, $i,"description")."".pg_result($sRes, $i,"type")."".pg_result($sRes, $i,"follow_up_action")."".pg_result($sRes, $i,"follow_up_date")."EditAction"; } } } ?> CRM - Events

Events Requiring Action

The limit 1 gets us the last qualifying event on each lead, and this result is stuck into an array which is sorted by follow_up_date prior to display. I probably didn't explain the problem too well! But thanks for the input. Andy On Wed, 2006-05-03 at 08:56 -0600, Sherwin M. Harris wrote: > Assuming you are using a version of a database that can support > sub-queries (MySQL 4.1 and up, Postgresql (all reasonably current > versions, any other robust RDBMS) you can do the query like this: > > $sSql = "SELECT * FROM crm_events WHERE crm_leads_id IN (SELECT id > FROM crm_leads) AND follow_up_action!='' ORDER BY follow_up_date asc > limit 1" > > Not sure what your follow_up_action !=” is suppose to be doing but if > the rest works for you that should give you what you want. > > > > > > > > > Sherwin Harris > > Web Developer > > Brigham Young University > > > > > > ______________________________________________________________________ > > From:pgsql-php-owner@postgresql.org > [mailto:pgsql-php-owner@postgresql.org] On Behalf Of Andy Dunlop > Sent: Wednesday, May 03, 2006 3:13 AM > To: pgsql-php@postgresql.org > Subject: [PHP] Select and order by question > > > > > > Hi - I have the following code: > > //show table of current events needing action > $sSql = "SELECT id FROM crm_leads "; > $sLeads = pg_exec($conn,$sSql); > for($e=0;$e $sSql = "SELECT * FROM crm_events WHERE crm_leads_id = > ".pg_result($sLeads,$e,"id")." AND follow_up_action!='' ORDER BY > follow_up_date asc limit 1"; > $sRes = pg_exec($conn,$sSql); > $sHits = pg_numrows($sRes); > if($sHits!=0){ > for($i=0;$i<$sHits;$i++){ > // generate the display here > } > } > > crm_leads is a parent with many crm_events as it's children. > This code gives me the correct set of rows. > My problem is that I want only the last row from crm_events (as per > limit 1) but I want those rows sorted by follow_up_date. I guess I > need to have the whole query in one select statement? But how? > > Any help appreciated > Thanks > > Andy Dunlop > > www.infocus.co.za > +27 21 532 0335 office > +27 82 770 8749 mobile > > > > > > Andy Dunlop www.infocus.co.za +27 21 532 0335 office +27 82 770 8749 mobile --=-Kprzzbv1kpE5F3Fsq9dx Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit If anyone is interested, here is the code we eventually have used:

<?php
$sSql = "select id from crm_leads ";
$sLeads = pg_exec($conn,$sSql);
for($e=0;$e<pg_numrows($sLeads);$e++){
    $sSql = "SELECT * FROM crm_events where crm_leads_id = ".pg_result($sLeads,$e,"id")." and follow_up_action!='' ORDER BY follow_up_date desc limit 1";
     $sRes = pg_exec($conn,$sSql);
     $sHits = pg_numrows($sRes);
      
        if($sHits!=0){
               
                for($i=0;$i<$sHits;$i++){
                       
                        $temp_date = explode("-",pg_result($sRes,$i,"follow_up_date"));
                        $temp_tstamp = gmmktime(0,0,0,$temp_date[1],$temp_date[2],$temp_date[0]);                                                         
                        $array_echo[$temp_tstamp] .= "<tr><td>".$compName1."</td><td>".$empl1."</td><td>".pg_result($sRes,$i,"date")."</td><td>".pg_result($sRes,$i,"description")."</td><td>".pg_result($sRes,$i,"type")."</td><td>".pg_result($sRes,$i,"follow_up_action")."</td><td>".pg_result($sRes,$i,"follow_up_date")."</td><td><a href='crm_events_edit.php?id=".pg_result($sRes,$i,"id")."'>Edit</a></td><td><a href='crm_events_bycomp.php?id=".pg_result($sRes,$i,"crm_leads_id")."'>Action</a></td></tr>";
                }
    }
}
?>
<html>
<head>
<title>
CRM - Events
</title>
</head>
<body bgcolor="<?echo $sBodyColor?>">
<?php require("menu.php"); ?>
<table width='100%'>
<tr><td><h2><font color='<? echo $sHeadingColor?>'>Events Requiring Action</font></h2></td>
<td align='right'><a href='manual/crm_events.html' target='_blank'><img src='images/help_btn.jpg' border=0></a></td>
</table>
<? asort($array_echo); ?>
<? foreach($array_echo as $ae){
        echo $ae;
   }
?>
<? echo $prog_echo_end; ?>
</body>
</html>

The limit 1 gets us the last qualifying event on each lead, and this result is stuck into an array which is sorted by follow_up_date prior to display.

I probably didn't explain the problem too well! But thanks for the input.
Andy


On Wed, 2006-05-03 at 08:56 -0600, Sherwin M. Harris wrote:
Assuming you are using a version of a database that can support sub-queries (MySQL 4.1 and up, Postgresql (all reasonably current versions, any other robust RDBMS) you can do the query like this:

$sSql = "SELECT * FROM crm_events WHERE crm_leads_id IN (SELECT id FROM crm_leads) AND follow_up_action!='' ORDER BY follow_up_date asc limit 1"

Not sure what your follow_up_action !=” is suppose to be doing but if the rest works for you that should give you what you want.

 

 


Sherwin Harris

Web Developer

Brigham Young University

 



From:pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org] On Behalf Of Andy Dunlop
Sent: Wednesday, May 03, 2006 3:13 AM
To: pgsql-php@postgresql.org
Subject: [PHP] Select and order by question


 

Hi - I have the following code:

//show table of current events needing action
$sSql = "SELECT id FROM crm_leads ";
$sLeads = pg_exec($conn,$sSql);
for($e=0;$e<pg_numrows($sLeads);$e++){
        $sSql = "SELECT * FROM crm_events WHERE crm_leads_id = ".pg_result($sLeads,$e,"id")." AND follow_up_action!='' ORDER BY follow_up_date asc limit 1";
        $sRes = pg_exec($conn,$sSql);
        $sHits = pg_numrows($sRes);
        if($sHits!=0){
                for($i=0;$i<$sHits;$i++){
              // generate the display here
        }
}

crm_leads is a parent with many crm_events as it's children.
This code gives me the correct set of rows.
My problem is that I want only the last row from crm_events (as per limit 1) but I want those rows sorted by follow_up_date. I guess I need to have the whole query in one select statement? But how?

Any help appreciated
Thanks

Andy Dunlop

www.infocus.co.za
+27 21 532 0335 office
+27 82 770 8749 mobile



 


Andy Dunlop

www.infocus.co.za
+27 21 532 0335 office
+27 82 770 8749 mobile
--=-Kprzzbv1kpE5F3Fsq9dx-- --=-h4COFrQejVYZef99DnpJ Content-ID: <1147246953.6686.74.camel@localhost.localdomain> Content-Disposition: attachment; filename=infocus_cropped.jpg Content-Type: image/jpeg; name=infocus_cropped.jpg Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQEAlQCVAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD//gAXQ3JlYXRlZCB3 aXRoIFRoZSBHSU1Q/9sAQwAFAwQEBAMFBAQEBQUFBgcMCAcHBwcPCwsJDBEPEhIRDxERExYcFxMU GhURERghGBodHR8fHxMXIiQiHiQcHh8e/9sAQwEFBQUHBgcOCAgOHhQRFB4eHh4eHh4eHh4eHh4e Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4e/8AAEQgAJABzAwEiAAIRAQMRAf/E AB0AAAIBBQEBAAAAAAAAAAAAAAAIBwEDBAUGAgn/xAA4EAABAwQBAwEGAgc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fSXB6MrRRRUlQooooAooooAooooD/9k= --=-h4COFrQejVYZef99DnpJ Content-Type: image/jpeg; name="image002.jpg" Content-ID: Content-Description: image002.jpg Content-Location: image002.jpg Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIf IiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCIoOzs7Ozs7 Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAAZAFADASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3 uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD1Gz1G 4n1y/s3ksmht1QosUu6Zcjnev8I9KjuPFvh60iWWfWrJUZioYTA8jr09K5nwv/yVrxh/1yt//Qar fCTSNOm8K3dxNZw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