Re: Stored Queries? was: Can anyone figure out this MySQL query?
Date: Wed, 30 Aug 2000 15:58:10 GMT
Message-ID: <8ojaui$fvu$1_at_highway.leidenuniv.nl>
In article <39ad1983.94500594_at_news.arnes.si>, do-not_at_spam.me wrote:
>Hi Theo;
>
>In regards to the last solution requiring 3 queries, is it possible to
>do this in MySQL 3.22.32 ? I had a look at the online documentation
>and it only mentioned that stored procedures where not possible yet.
>Also I looked through MySQL by Paul DuBois, but there was only a small
>bit on redirecting commands stored in a flat file to the mysql program
>from the command line.
>I suppose the other way might be to use temporary tables.
>Which method did you have in mind?
>
>Best Regards
> Chris
Well,
Actually I didn't read the original question correctly. The answer involving
three queries should work in MS Access (not my favourite dbms). I don't know a
bit about MySQL, apart from its being popular for web applications.
Does MySQL have a way of nesting queries? ("Nested Table Expressions") I have never actually used such stuff before and it's the end of the day. It should be possible to rephrase the 3 queries into something along the lines of
SELECT i.*
FROM (SELECT HotelNo, count (*)
FROM Invoices
WHERE CustomerNo IN (1,2, ... n)
GROUP BY HotelNo
HAVING count (*) > 5) as h,
INVOICES as i
WHERE i.HotelNo=h.HotelNo
AND i.CustomerNo IN (1,2, ... n)
.. SYSADMIN says I've to log off Received on Wed Aug 30 2000 - 17:58:10 CEST
