SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE telephone ( id int(11) NOT NULL AUTO_INCREMENT, name varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, tel1 bigint(20) UNSIGNED NULL DEFAULT NULL, tel2 bigint(20) UNSIGNED NULL DEFAULT NULL, tel3 bigint(20) UNSIGNED NULL DEFAULT NULL, tel_balance1 decimal(65, 2) NULL DEFAULT 0, tel_balance2 decimal(65, 2) NULL DEFAULT 0, tel_balance3 decimal(65, 2) NULL DEFAULT 0, birthday date NULL DEFAULT NULL, PRIMARY KEY (id) USING BTREE ); INSERT INTO telephone VALUES (1, 'Name', 38090123456, 38080123456, 38070123456, 111, 222, 333, '1980-02-03'); SELECT * FROM telephone; SELECT ID, tel_balance1 * (tel1 LIKE "38090%") + tel_balance2 * (tel2 LIKE "38090%") + tel_balance3 * (tel3 LIKE "38090%") AS balance_38090 FROM telephone WHERE tel1 LIKE "38090%" OR tel2 LIKE "38090%" OR tel3 LIKE "38090%" ;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear