Jump to content

SELECT / EXCLUSIVE JOIN


nscnick

Recommended Posts

I am trying to extract data from one table that contains a master list of records, data that that is not listed in another comparison table. (ie the second table contains a subset of the first table, and I want to list all that are left).I have tried a delete operation but that seems to require a specific single data item to compare with.Effectively it is a select from table1 where entries are not in table2 but this concept just doesn't seem to work.As it happens the data is in MS Access. The tables are a member list, and the second is a list of those who have booked an event. What I need is a list of those who haven't booked. It seems a straightforward query but I cannot get it to work.Can anyone please help?

Link to comment
Share on other sites

Have you tried something like:

SELECT MemberIDFROM Members WHERE MemberID NOT IN (SELECT MemberID FROM MemberBookings)

Link to comment
Share on other sites

I have a similar prob here is my code and it is not working.

<?//Database Information$dbhost = "******";$dbname = "******";$dbuser = "*****";$dbpass = "****";//Connect to databasemysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());mysql_select_db($dbname) or die(mysql_error());$query = 'SELECT COUNT( * ) AS `Rows` , `username` FROM `users` GROUP BY `username` ORDER BY `userid` ASC LIMIT 0, 30 '; $result = mysql_query($query);?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...