here is the sql dump for my database structure
# phpMyAdmin MySQL-Dump
# version 2.4.0-rc2
# [url]http://www.phpmyadmin.net/[/url] (download page)
#
# Host: localhost
# Generation Time: Feb 01, 2005 at 01:32 PM
# Server version: 4.0.15
# PHP Version: 4.2.2
# Database : `littleblackbook`
# --------------------------------------------------------
#
# Table structure for table `customers`
#
CREATE TABLE customers (
id int(5) NOT NULL auto_increment,
surname varchar(24) NOT NULL default '',
firstname varchar(24) NOT NULL default '',
gender varchar(6) NOT NULL default '',
age int(3) NOT NULL default '0',
phone varchar(15) NOT NULL default '',
postcode varchar(4) NOT NULL default '',
email varchar(60) NOT NULL default '',
date_created date NOT NULL default '0000-00-00',
receipt_number varchar(40) NOT NULL default '',
event_name varchar(100) NOT NULL default '',
referral varchar(40) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Dumping data for table `customers`
#
INSERT INTO customers VALUES (1, 'Roberts', 'Rhod', 'male', 22, '22222222', '2222', 'rhod@littleblackbook.com.au', '2005-02-01', '1107220915-Roberts', 'Sand Bar (0434)', 'Friend attended an event');
INSERT INTO customers VALUES (2, 'dave', 'dave', 'Male', 22, '222222222', '2222', 'dfsdfjW@ail. com', '2005-02-01', '', 'Mailout', '');
INSERT INTO customers VALUES (3, 'Morris', 'Craig', 'male', 22, '22222222', '2222', 'rhod@littleblackbook.com.au', '2005-02-01', '1107220915-Roberts', 'Sand Bar (0434)', 'Friend attended an event');
INSERT INTO customers VALUES (4, 'Morris', 'Craig', 'female', 22, '22222222', '2222', 'rhod@littleblackbook.com.au', '2005-02-01', '1107220915-Roberts', 'Sand Bar (0434)', 'Friend attended an event');
# --------------------------------------------------------
#
# Table structure for table `events`
#
CREATE TABLE events (
id int(5) NOT NULL auto_increment,
title varchar(200) NOT NULL default '',
date date NOT NULL default '0000-00-00',
brief text NOT NULL,
description text NOT NULL,
image_s varchar(200) NOT NULL default '',
image_l varchar(200) NOT NULL default '',
url varchar(40) NOT NULL default '',
price decimal(6,2) NOT NULL default '0.00',
maleplaces int(10) NOT NULL default '0',
femaleplaces int(10) NOT NULL default '0',
male_places_override varchar(250) NOT NULL default '',
female_places_override varchar(250) NOT NULL default '',
address varchar(250) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Dumping data for table `events`
#
INSERT INTO events VALUES (1, 'Sand Bar (0434)', '2005-02-02', 'Sydney- 22-35 yrs', 'Think martinis and moody music, Sand Bar is an inviting, private lounge bar ideal for Speed Dating with style. The contemporary lighting, original sandstone walls and stylish lounge seating provides a comfortable yet sophisticated atmosphere.\r\n\r\nThis venue was made for Speed Dating! Whilst the setting is spacious the subdued lighting offers pools of intimacy. The feel-good vibe is enhanced by the great acoustics and mellow beats.\r\n\r\nFor such a salubrious spot the bar prices are refreshingly reasonable. We offer a great cocktail special for $8 and the bar has an extensive cocktail list and range of tap beers. If you think things might get out of control, don\'t worry. LittleBlackBook will also be throwing in some free pizza to help soak up the drinks!\r\n\r\nWHEN BOOKING BY PHONE PLEASE KEY IN BOOKING CODE: 0434', 'SAND thb 2.jpg', 'Sand wd.jpg', 'www.merivale.com', '39.00', 5, 18, '', '', '6.45pm Wed 2nd Feb\r\nSlip Inn\r\n111 Sussex Street\r\nSydney 2000');
INSERT INTO events VALUES (2, 'Sand Bar (0442)', '2005-02-09', 'Sydney- 22-35 yrs', 'Think martinis and moody music, Sand Bar is an inviting, private lounge bar ideal for Speed Dating with style. The contemporary lighting, original sandstone walls and stylish lounge seating provides a comfortable yet sophisticated atmosphere.\r\n\r\nThis venue was made for Speed Dating! Whilst the setting is spacious the subdued lighting offers pools of intimacy. The feel-good vibe is enhanced by the great acoustics and mellow beats.\r\n\r\nFor such a salubrious spot the bar prices are refreshingly reasonable. We offer a great cocktail special for $8 and the bar has an extensive cocktail list and range of tap beers. If you think things might get out of control, don\'t worry. LittleBlackBook will also be throwing in some free pizza to help soak up the drinks!\r\n\r\nWHEN BOOKING BY PHONE PLEASE KEY IN BOOKING CODE: 0442', 'SAND thb 2.jpg', 'Sand wd.jpg', 'www.merivale.com', '39.00', 18, 18, '', '', '6.45pm Wed 9th Feb\r\nSlip Inn\r\n111 Sussex Street\r\nSydney 2000\r\n');
I did not design the database, I have only modified it slightly to maintain compatibility with the code I've been given.
What I need to do is, given an Event ID - count the number of males and females registered in each event IN TH E SAME ROW.
the server it is running on does not have the ability for sub queries...
good luck 😃