update threeCard() and improved the SQL query