2009/11/05

two select

Two selects:

SELECT cart_name as tag, count(cart_name) as frequency
From
  (SELECT distinct cart_name , account_id
   FROM `account_cart`
   where cart_name REGEXP '^[a-z]+'
) as tb1
Group by cart_name



2009/11/03

empty matches 0 in sql????

page_id = '', the following sql still work.

SELECT SQL_CACHE a.unique_id, b.banner_id, a.page_id, a.grp, a.page_pos,
a.order_seq, b.banner_type, b.image_name, b.link, b.target, b.params, ''
AS sku_list
FROM page_banners_link a, page_banners b
WHERE a.page_id = ''
AND site_id = '0'
AND a.banner_id = b.banner_id
ORDER BY a.page_pos, a.page_id, a.order_seq
LIMIT 0 , 30

2009/11/02

how to purge master logs

> on master:    mysql -p

> 

> mysql >  show master status;

> 

> 

> on slave:   mysql -p

> 

> mysql > show slave status;

> 

> 

> If both master and slave are processing the same replication log file

> (meaning that replication is running correctly),  then you can safely

> run the following commend on master:

> 

> 

> mysql > purge master logs to "current-replication-log-filename";