OK. No offense, but that seems fairly easy.
Here's one possible answer:
select categories.*,count(dv_id)
from categories
left join dvds on dv_caid=ca_id
group by ca_name
having ca_name not like 'T%';
On Dec 1, 2004, at 8:13 AM, Tristan.Pretty@xxxxxxxxxxxxxxxx wrote:
I recently saw a job that I thought I'd be good for, so they sent me a
test...
All good.. but I realised that I couldn't do it..
I got sooo damned close, but could not finish... :-(
Anyhoo, here's the test:
http://www.beertastic.co.uk/test_problem.zip
And the test parameters are below
If anyone can tell me the answer, I'd appreciate it, then I can
de-engineer it, and hopefully learn something.
I've already mailed them and said thanks, but I give up ;-)
I my prob was in gettin ga distict list of all DVD categories, from
within
the final results page...
Hmmm, any takers?
TASK:-
Modify the test.php file (attached) so a list of categories and the
number of DVDs in each category are displayed when the script is called
in a browser. (See resultspage.html for the EXACT output required)
You must complete the getNumDvdsInCategories() function to query the
database and return a multidimensional array in the required format.
You may use the PHP and MySQL manuals available online.
RESTRICTIONS:-
You may only make ONE select query to the database.
Do not edit code outside the getNumDvdsInCategories() function. The
results in the table must be in alphabetical order (category name). The
Drama category MUST appear even though there are no DVDs in the
category. Categories beginning with the letter "T" must not be
displayed. Values in the database cannot be hardcoded anywhere in the
script.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php