2013年5月31日 星期五

mysql left join - 可以利用foreign key的關聯相關表格來補充擴充欄位

select a.c1, b.c2 from a left join b on a.c1 = b.c1
其實left join 是指 把 b 沒有符合 的也列出來 但是加了 where 會強制 b.c2 一定要符合 2009-10-23

範例


//195筆
select `store_book`.* from `store_book` where  `store_book`.`store_code`='P018' and `store_book`.`seat_name`='不限定'


//34筆 - cross table 相同user_id
select `store_book`.*,`user`.`UName`,`user`.`UPhone` from `store_book`, `user` where   `user`.user_id=`store_book`.user_id  and `store_book`.`store_code`='P018' and `store_book`.`seat_name`='不限定'

用left join從user表中來擴充UName,UPhone資訊

// 195筆
select `store_book`.*,`user`.`UName`,`user`.`UPhone` from `store_book` left join `user` on   `user`.user_id=`store_book`.user_id  where `store_book`.`store_code`='P018' and `store_book`.`seat_name`='不限定'


2013年5月23日 星期四

更改DNS對應IP,移機後的Drupal無法啟動


查詢網路發現可能是cache沒有清除乾淨
---
drupal 可以用phpmyadmin清除的資料表
Which Drupal tables are safe to manually clear using phpmyadmin?

In my experience, I purge all of the "cache_*" tables.
cache
cache_*


plus "watchdog" if I don't care about past Drupal logs
plus "accesslog" if I don't care about logged-in users
plus "search" if I don't care about indexed nodes contents

boost_cache
boost_cache_relationships

----
原來問題是  drupal_test/phpBB3/config.php 裡面有資料庫設定錯了
因為當初是用IP設定連結的Orz

----
要找出這個問題可以用字串搜尋的方式
方式很多,比方像是:

linux搜尋特定字串的指令

grep -r "STRING" /path
find /path -type f | xargs grep "STRING"
----