Two queries versus one combined query

Tech-Archive recommends: Speed Up your PC by fixing your registry



I have a classic asp page that lists products. Right now, there is
one query to get the list of products (from a product view), and then
another query to get the individual merchant's information (from a
vendor view). I am thinking that using one query for both is going to
save some server time because it's only one trip to the db. In my
testing, however, it seems that the time to do both is .00 and to do a
combined query is .01.

I am using MS SQL.

Here's my original query:

SELECT product_ipk, product_name, displaytext, image_path,
description, price, vendor_name, vendor_ipk,
city_name, category_description, classification_name, discounttype
FROM view_product WITH(NOEXPAND)
WHERE vendor_ipk = 1581365
AND city_id IN (18399)
ORDER BY product_ipk

Here is my proposed query:

SELECT product_ipk, product_name, displaytext, p.image_path,
p.description, price, v.vendor_name, p.vendor_ipk, p.city_name,
p.category_description, p.classification_name, p.discounttype,
v.street_no, v.street_name, v.location, v.state_abbr, v.phone1a,
v.phone1n, v.email, v.url, v.dispemail
FROM view_product p WITH(NOEXPAND)
JOIN view_vendor_default v ON v.vendor_ipk = p.vendor_ipk
WHERE category_ipk = 110
AND p.city_id IN (18399)
ORDER BY product_ipk

Any thoughts? I am correct that the combined query is better in the
long run? I don't think I can make a sp out of this because the user
can choose sorting, and can also include a keyword search.

TIA
--
Adrienne Boswell at work
Administrator nextBlock.com
http://atlas.nextblock.com/files/
Please respond to the group so others can share

.



Relevant Pages

  • Re: One query blanking another
    ... If I understand correctly, you created a query using 3 other queries as input "tables", and in the upper pane of table design, there is a line joining one query to the others? ... If both the other queries join to the one that has no records, you may need a different approach. ... completely empty even though individually, ... How can I get the combined query to list all available info and simply have ...
    (microsoft.public.access.queries)
  • RE: Calculated result of two different queries.
    ... Post the SQL of the combined query so we have a look. ... Dave Hargis, Microsoft Access MVP ...
    (microsoft.public.access.reports)
  • Re: Combine queries
    ... Unless you made a typo, I don't see where Query 1 is referenced in Q3. ... for some queries Access will tell you (I forget the exact ... I would like to eventually run the combined query from Excel ...
    (microsoft.public.access.gettingstarted)
  • RE: Link Query
    ... but i did not under the sumof concept how to do ... below is your query: ... I have one Union Query which contain only customer Names, ... Combined Query: ...
    (microsoft.public.access.queries)