Date: 03/09/06 (PHP Community) Keywords: php, mysql, sql Hi guys, $sql = "SELECT TOP 100 PERCENT Mem_Number, Title_1, Name_1, Surname_1, Email, Date_Sent_Renewal, EmailList, Renewal_Date FROM BTCMembers WHERE (DATEDIFF(d, Renewal_Date, GETDATE()) > ".$cutoff.") AND (DATEDIFF(d, Renewal_Date, Date_Sent_Renewal) < 0) AND (Email <> '') AND (Date_Sent_Renewal <> '') AND (EmailList = 1) ORDER BY Mem_Number ASC"; Now this query works exactly as I expect it to, but some of the data which is pulled could cause minor problems later. Specifically, there are a few records which have an "Email" field value of "N/A" -- the fault of dodgy input validation, I know, but I didn't make the input interface. *shrug* So, is there a way to write the query so that data pulled from the Email column must make a regular expression valid for email addresses? Posted to php, sqlserver, and mysql
|