Title / Description
Code SELECT COUNT(*) AS valid_records_count FROM ( SELECT *, CASE WHEN ${phone} RLIKE '^(?:(?:\+|00)86)?1[3-9]\\d{9}$' THEN 1 ELSE 0 END AS phone_valid_count, CASE WHEN ${id_number} RLIKE '^[1-9]\\d{5}(?:18|19|20)\\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\\d|30|31)\\d{3}[\\dXx]$' THEN 1 ELSE 0 END AS id_number_valid_count, CASE WHEN ${email} RLIKE '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$' THEN 1 ELSE 0 END AS email_valid_count FROM ${table} WHERE ${cust_type} = 1 and ${partition}) subquery WHERE (phone_valid_count + email_valid_count + id_number_valid_count) >= 2;
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code