Date: 06/29/02
- Next message: andy: "[PHP-DB] saving temporary image to database"
- Previous message: Matthew Nock: "[PHP-DB] MySQL query from multiple tables"
- In reply to: tatang <email protected>: "[PHP-DB] MySQL Indexing Size"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I have an interesting project where I need to find an agent_id from one
table such that he has the least number of associated records (or
preferably none) in a second table. Simple definition of the tables is:
Agents Table:
AgentID int primary key auto_increment
FName, LName and other details of this agent
Users Table:
UserID int primary key auto_increment
AgentID int --> AgentsTable
Orders, Datestamp, other details
The Agent is assigned to the User on a rotation basis, where an Agent
who does not have any assignments, or has the least number is the next
one to be picked.
Is it possible to do a join of some kind (I'm not too good at joins)
that would determine the Agent with the least number of associated
records in the User table?
Terry
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: andy: "[PHP-DB] saving temporary image to database"
- Previous message: Matthew Nock: "[PHP-DB] MySQL query from multiple tables"
- In reply to: tatang <email protected>: "[PHP-DB] MySQL Indexing Size"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

