POV-Ray : Newsgroups : povray.off-topic : SQL question : Re: SQL question Server Time
29 Sep 2024 15:27:58 EDT (-0400)
  Re: SQL question  
From: scott
Date: 11 Mar 2009 05:28:00
Message: <49b78420@news.povray.org>
> I don't have an SQL engine in front of me, but I would have expected
>
>   SELECT ExpID, COUNT(*) FROM Table WHERE EventID=1 GUOP BY ExpID;

I think I tried that and got back something like:

ExpID Count
1     1
2     1

BTW does it matter if I drop the ExpID after the SELECT, I'm not interested 
in any experimentID, just the count of them that have an ID=1 event.

I will try later to see if I actually did try that or not (the code and 
database is on another machine).

>   SELECT ExpID, COUNT(*) / Total
>   FROM Table, (SELECT COUNT(*) as Total FROM Table2)
>   GOUP BY ExpID;

Oh ok cool, will experiment with that sort of syntax.

The reason I want it all in one SQL function is that I'm thinking of making 
some external text-based file that lists all the possible queries people 
might want to run on the data, so then the code will be much simpler (no 
repeats of lots of SQL code and associated fluff) and I can change the 
queries without modifying the actual code.  That way, the user can simply 
choose "% failed due to Event blah blah" and the code will get the 
associated query from the text file and run it automatically.  Someone has 
probably already invented a much better way to do this sort of thing, but 
hey this is my first database app!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.