Skip to main content
Inspiring
February 13, 2007
Question

cfquery and select question

  • February 13, 2007
  • 5 replies
  • 381 views
I just finished chapter ten of CFWACK and am in the process of
dynamifying my site. Currently all of this revolved around my client
table, displaying their company name, image names, testimonial, etc.

Right now I have four cfquerys containing three to ten Select
statements. My question is, should I combine all four cfquerys into one
main query? Or should I just leave them separate?
This topic has been closed for replies.

5 replies

Inspiring
February 13, 2007
Sabaidee wrote:
> then combine them into one: at least you will be making fewer requests/trips to the database...
>

Thanks. I was able to combine four pages' similar queries into one
query, which I made into an include template. Much easier to work with
now. I just had to add all the Select row names and it works perfectly.

Though I did have to leave two pages' querys out because they used
different SQL statements entirely, but I'm very pleased with the results.
Inspiring
February 13, 2007
then combine them into one: at least you will be making fewer requests/trips to the database...
Inspiring
February 13, 2007
What's that part again about having three to ten selects in 4 queries?
Inspiring
February 13, 2007
Dan Bracuk wrote:
> It depends on:
> Can the tables be joined?
> Will a single query give you the data you need?
> What will run faster (it's not always one query, you gotta test it)

It's all from the same table. There isn't much data, just client info
such as name, website, testimonial, etc.

Yes, a single query will give me all the data I need.

I'm not sure about it running faster, but I don't think it will make a
difference.

Should I leave them separate or join them into one query?
Inspiring
February 13, 2007
It depends on:
Can the tables be joined?
Will a single query give you the data you need?
What will run faster (it's not always one query, you gotta test it)