I have 2 tables, user and address. Since a user can have multiple addresses, I designate one as primary in user (user.primaryAddressId->address.addressId). When displaying addresses, I always want the primary address to be first. The basic query is:
Code:
 SELECT user.userId, user.primaryAddressId, a.address
 FROM user, address
 WHERE address.userId = user.userId
Since there could be multiple addresses, how can I word the query, presumedly in an ORDER BY clause, to return first the primary address, then the others?