Query optimizing

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Preet Kanwaljit Singh Shergill (preetsinghasr_at_hotmail.com)
Date: 03/07/04


Date: Sun, 07 Mar 2004 05:58:51 -0800

I am running seven queries in a loop for mining 7 different data, like

select count(*) from table where column1 = 2 and column2 = 2 and column3
= 2

now every time these queries run they consume a lot of network traffic
because in each loop upto 49 queries are run.

now i wish to combine all these 7 queries into a single query so as to
reduced network traffic, how do i proceed.

in oracle we have something like

select count(decode(dept_no, 10, 1)), count(decode(dept_no, 20, 1)) from
table

do we have something similar in sql ??

kindly advice.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: [PHP] Loop issues
    ... The reason is because the first time the while loop executes, it sets $name from unset to 'Bob' and on the second time through, it sets $name from 'Bob' to 'Alice'. ... The issue isn't just echoing in a loop, but defining an array of results to begin with. ... Below are my queries. ... Smith, James Smith. ...
    (php.general)
  • Re: [PHP] Loop issues
    ... I am having trouble trying to figure out how I should compose this loop to ... Below are my queries. ... Smith, James Smith. ... Because of this I think I need to put a loop where the echo ...
    (php.general)
  • Re: At wits end - code breaks even with OnError Resume Next
    ... loop through the tables and write their names and the ... descriptions to a "Queries" table. ... >error handler, but there is another way that you can go through the ... >> I've built this db that goes to other Access dbs, ...
    (microsoft.public.access.modulesdaovba)
  • only in vertical on continuous form?
    ... form use some queries to write each non null field to a table. ... How can i loop through the control values and read/write the records to ...
    (microsoft.public.access.forms)
  • Re: Perl DBI - How to handle large resultsets?
    ... > to the queries because I edited that out. ... This line is probably better outside the while loop; ... Again, as Xho suggests, finishshould not be called on $repo_sth. ... while loop should have eaten up the result set and caused DBI to call ...
    (comp.lang.perl.misc)