Selon Russell Horn <[EMAIL PROTECTED]>: > This must have come up before, but I've not found it using a google > search. > > I have two tables customer and purchases > > customer: > customerID > customerName > > purchases: > purchaseID > customerID > purchaseDate > purchaseValue > > Is it possible in MySQL to join the tables so I only get the value of > the latest purchase? Or is this something that's better done in PHP, say > select all my customers and then one at a time do a query to select the > value of their last purchase? > > Thanks! > > Russell. > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > >
Hi , join the tables with max(purshase_date) in the select,an dof course group by customer_id Hope that helps :o) Mathias -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]