Question: I have this query 

```
SELECT COUNT(*) from `login_log` where from_unixtime(`date`) >= DATE_SUB(NOW(), INTERVAL 1 WEEK);

```

and the same one with 1 diff. it's not **1 WEEK** , but **1 MONTH** 
how can I combine those two and assign them to aliases?

Answer: 
I would do this with conditional aggregation:

```
SELECT SUM(from_unixtime(`date`) >= DATE_SUB(NOW(), INTERVAL 1 WEEK)),
       SUM(from_unixtime(`date`) >= DATE_SUB(NOW(), INTERVAL 1 MONTH))
FROM `login_log`;

```

MySQL treats boolean values as integers, with `1` being "true" and `0` being "false". So, using `sum()` you can count the number of matching values. (In other databases, you would do something similar using `case`.)
Even though it's pretty tough to understand what you ask:

If you want them in the same column use `OR`

```
SELECT COUNT(*) from 'login_log' where from_unixtime('date') >= DATE_SUB(NOW(), INTERVAL 1 WEEK) OR from_unixtime('date') >= DATE_SUB(NOW(), INTERVAL 1 MONTH) ;

```

If you don't want duplicate answers: use `GROUP BY`