Hi all,
in this table I log the users of an e-commerce
CREATE TABLE IF NOT EXISTS user_access (
id BIGINT UNSIGNED NOT NULL auto_increment,
session_id CHAR(64) NOT NULL,
fb_id BIGINT unsigned DEFAULT NULL,
browser_id SMALLINT NOT NULL,
so_id SMALLINT NOT NULL,
device_id SMALLINT NOT NULL,
referer_id SMALLINT DEFAULT NULL,
ip VARCHAR(15) NOT NULL,
log_fb_datetime DATETIME DEFAULT NULL,
access_start_datetime DATETIME NOT NULL,
access_end_datetime DATETIME DEFAULT NULL,
country_code CHAR(2) DEFAULT NULL,
country_name VARCHAR(255) DEFAULT NULL,
region_code TINYINT DEFAULT NULL,
region_name VARCHAR(255) DEFAULT NULL,
city VARCHAR(255) DEFAULT NULL,
lat FLOAT( 10, 6 ) DEFAULT 0 ,
lng FLOAT( 10, 6 ) DEFAULT 0,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
if the fb_id is null the user has never sign up to the app
I want to find how many users have used my app only one
and never logged in.
My best but it doesn’t work
SELECT COUNT( * ) AS num
FROM sharint_user_access
WHERE fb_id IS NOT NULL
GROUP BY fb_id
HAVING num =1
Can you help me,please ?