Where In Sort order

SELECT * FROM project_features WHERE id IN (3,1) ORDER BY FIELD(id, 3,1)

MYSQL Fetch By Year and Month

::Count by Year and Month
SELECT YEAR(`date`) as year_val, MONTH(`date`) as month_val ,COUNT(*) as total
FROM news
GROUP BY YEAR(`date`), MONTH(`date`)
ORDER BY year_val desc, month_val asc;

::Fetch By Year and Month
SELECT * FROM news WHERE MONTH(`date`) = 10 and YEAR(`date`) = 2011;

Mysql Double Date Duration Fetch intersection

|————————————| search set duration
album date duration
x |—-|
o |——————|
o |——————————————————|
o |————|
o |—————————————-|
x |—-|

SET @s_date = CURDATE();
SET @duration = 0;

SELECT * FROM albums
WHERE
album_date – INTERVAL album_date_duration DAY BETWEEN @s_date – INTERVAL @duration DAY and @s_date + INTERVAL @duration DAY
OR
album_date + INTERVAL album_date_duration DAY BETWEEN @s_date – INTERVAL @duration DAY and @s_date + INTERVAL @duration DAY
OR
(
album_date – INTERVAL album_date_duration DAY = @s_date + INTERVAL @duration DAY
)

ruby on rails LoadError in

Action Controller: Exception caught

LoadError in RecipesController#index

127: 지정된 프로시저를 찾을 수 없습니다.   - c:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so

RAILS_ROOT: D:/aptana/Guestbook

console

Rendering c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/templates/rescues/layout.erb (not_found)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
ontroller/templates/rescues/layout.erb (not_found)

php 의 libmysql.dll 을 /ruby/bin/  에 copy