> $sql = 'SELECT Username, Count( Username ) FROM MainDetails, Usernames > WHERE MainDetails.UserID = Usernames.UserID and Date Between \'$Date1\' > and \'$Date2\' GROUP BY Username'; > > The strange thing is if I replace the $Date2 variable with a date manually > it works -. i.e.
Not a MySQL issue, but an error in your PHP code. Single quotes do NOT replace variables with their values, so if you use double quotes: $sql = "SELECT Username, Count( Username ) FROM MainDetails, Usernames WHERE MainDetails.UserID = Usernames.UserID and Date Between '$Date1' and '$Date2' GROUP BY Username"; it will work. Regards, Jigal -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]