numbers of the customers who used more than one payment type.
select COUNT(PaymentType) CountOfCust,PaymentType,CustNum from
GRPUP BY PaymentType,CustNum
You have to use a GROUP BY query, with a COUNT(*) aggregated function.
Since Date_Used is a DATETIME column, it can contain the DATE part but
also the TIME part, so you have to extract just the DATE part using
Name AS licenseNames,
COUNT(*) AS logins
B INNER JOIN A
ON A.License_Key = B.License_Key
Here's one idea - but I'm not certain that (my)sql is the best tool
for combinatorial problems...
DROP TABLE IF EXISTS my_table;
CREATE TABLE my_table
(id1 INT NOT NULL,id2 CHAR(3) NOT NULL,PRIMARY KEY(id1,id2));
INSERT INTO my_table VALUES
FROM my_table x
To answer the first part of the question (about comparing every
There isn't really a good way to do that, other than write a bunch of
if statements. Of course; you probably shouldn't be doing that anyways
You could probably use reflection and recursion, but thats going to
get messy really fast.
Luckily, to just get the percentage occurrence of each flag, you can