Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Pure SQL or dtype="query" anyone?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Shaun Perry  
View profile  
 More options Oct 16, 8:12 am
From: "Shaun Perry" <sh...@wiredmonkey.co.uk>
Date: Fri, 16 Oct 2009 13:12:01 +0100
Local: Fri, Oct 16 2009 8:12 am
Subject: Pure SQL or dtype="query" anyone?

Hi all

Hope everyone's looking forward to the weekend. I certainly am!

I asked a few weeks ago if anyone had seen a coldfusion database query tool.
I found a plugin for ExtJS which basically creates the WHERE statement from
the choices you make (CherryExt). I've ported the backend code to Coldfusion
but am having a few problems with the SQL. Some the SQL has subqueries for
counting rows etc. If I pass in a SQL filter of "materialsent = 1" into the
first query it obviously fails, so I got around it by then querying a query.
It means I have to load the whole recordset in the first query (very slow
with large recordsets) and also qoq do not allow me to use the limit
command. Does anyone have any suggestions of how I could do this better or
point me in the right direction, SQL isn't my strongest skill!

<cfquery name="returnData" datasource="#application.settings.datasource#">
 SELECT tbl_organisations.id, tbl_organisations.name,
tbl_organisations.datecreated,
  (SELECT COUNT(*)
        FROM lnk_materials
        WHERE tbl_organisations.id = lnk_materials.orgId) AS materialsent
 FROM tbl_organisations
</cfquery>

<cfquery name="returnData" dbtype="query">
 SELECT *
 FROM returnData
 WHERE #getSQL(filters)#
</cfquery>

Kind regards

Shaun Perry

Wiredmonkey
+44 (0)131 2080811
+44 (0)7921 121021
 <http://www.wiredmonkey.co.uk/> www.wiredmonkey.co.uk
 <http://www.wiredmonkey.co.uk/blog> www.wiredmonkey.co.uk/blog

  <http://www.wiredmonkey.co.uk/images/dev.gif>

This e-mail is confidential and should not be used by anyone who is not the
original intended recipient. If you have received this e-mail in error
please inform the sender and delete it from your mailbox or any other
storage mechanism. Wiredmonkey cannot accept liability for any statements
made which may be the sender's own and not expressly made on behalf of
Wiredmonkey. Electronic mail is not a secure form of communication and can
be subject to interference.

  dev.gif
1K Download

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gareth.cole  
View profile  
 More options Oct 16, 8:20 am
From: "Gareth.cole" <gareth.c...@esus.ie>
Date: Fri, 16 Oct 2009 13:20:33 +0100
Local: Fri, Oct 16 2009 8:20 am
Subject: Re: [SCFUG] Pure SQL or dtype="query" anyone?
Hi Shaun,

You might want to try re-writing the first query using GROUP BY to get the
aggregate information. Some of the filters would go in the WHERE statement,
and some in a HAVING statement.
Been a while since I've used HAVING, so I'm not 100% sure this will work

121021www.wiredmonkey.co.ukwww.wiredmonkey.co.uk/blog

Sent to you using Uebimiau Webmail version 3.11
Developed by Dave and Todd at http://www.manvel.net and http://www.tdah.us

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shaun Perry  
View profile  
 More options Oct 16, 8:50 am
From: "Shaun Perry" <sh...@wiredmonkey.co.uk>
Date: Fri, 16 Oct 2009 13:50:35 +0100
Local: Fri, Oct 16 2009 8:50 am
Subject: RE: [SCFUG] Re: Pure SQL or dtype="query" anyone?
Hi Gareth

I'm changing the backend code so I can split some of the filters into the
where statement and some into the having statement, thanks for pointing me
in the right direction!

Cheers

Shaun


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Robertson-Ravo  
View profile  
 More options Oct 17, 4:01 am
From: Neil Robertson-Ravo <neil.robertson.r...@googlemail.com>
Date: Sat, 17 Oct 2009 09:01:55 +0100
Local: Sat, Oct 17 2009 4:01 am
Subject: Re: [SCFUG] Pure SQL or dtype="query" anyone?

And unless stuff has change since I left the coding arena full time -  
you should also avoid using Select (*) - again this may have been all  
improved over the years?

Sent from my iPhone

On 16 Oct 2009, at 13:12, "Shaun Perry" <sh...@wiredmonkey.co.uk> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen Moretti  
View profile  
 More options Oct 17, 5:57 am
From: Stephen Moretti <stephen.more...@gmail.com>
Date: Sat, 17 Oct 2009 10:57:33 +0100
Local: Sat, Oct 17 2009 5:57 am
Subject: Re: [SCFUG] Re: Pure SQL or dtype="query" anyone?

Nope. No change. You should always select the columns you need rather than *
select all the columns.

Stephen

On Oct 17, 2009 9:05 AM, "Neil Robertson-Ravo" <

neil.robertson.r...@googlemail.com> wrote:

And unless stuff has change since I left the coding arena full time - you
should also avoid using Select (*) - again this may have been all improved
over the years?

Sent from my iPhone

On 16 Oct 2009, at 13:12, "Shaun Perry" <sh...@wiredmonkey.co.uk> wrote: >
Hi all >   > Hope ever...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google