忍者ブログ

カレンダー

03 2024/04 05
S M T W T F S
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

リンク

最新記事

カテゴリー

最新コメント

RSS

ブログ内検索

アーカイブ

[1]  [2

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

MySQL 複数カラムにinを使うwhere句

SELECT
    *
FROM
    table_name 
WHERE
    (col1, col2) IN (
        ("hoge", "fuga"),
        ("foo", "bar")
    )

拍手[0回]

PR

カタカナ⇒ひらがな 力わざ

UPDATE `_table_` SET _column_ = REPLACE(_column_,"ア", "あ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"イ", "い");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ウ", "う");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"エ", "え");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"オ", "お");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"カ", "か");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"キ", "き");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ク", "く");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ケ", "け");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"コ", "こ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"サ", "さ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"シ", "し");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ス", "す");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"セ", "せ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ソ", "そ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"タ", "た");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"チ", "ち");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ツ", "つ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"テ", "て");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ト", "と");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ナ", "な");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ニ", "に");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ヌ", "ぬ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ネ", "ね");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ノ", "の");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ハ", "は");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ヒ", "ひ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"フ", "ふ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ヘ", "へ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ホ", "ほ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"マ", "ま");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ミ", "み");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ム", "む");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"メ", "め");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"モ", "も");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ヤ", "や");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ユ", "ゆ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ヨ", "よ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ラ", "ら");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"リ", "り");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ル", "る");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"レ", "れ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ロ", "ろ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ワ", "わ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ヲ", "を");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ン", "ん");


UPDATE `_table_` SET _column_ = REPLACE(_column_,"ガ", "が");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ギ", "ぎ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"グ", "ぐ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ゲ", "げ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ゴ", "ご");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ザ", "ざ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ジ", "じ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ズ", "ず");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ゼ", "ぜ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ゾ", "ぞ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ダ", "だ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ヂ", "ぢ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ヅ", "づ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"デ", "で");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ド", "ど");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"バ", "ば");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ビ", "び");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ブ", "ぶ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ベ", "べ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ボ", "ぼ");


UPDATE `_table_` SET _column_ = REPLACE(_column_,"パ", "ぱ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ピ", "ぴ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"プ", "ぷ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ペ", "ぺ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ポ", "ぽ");


UPDATE `_table_` SET _column_ = REPLACE(_column_,"ャ", "ゃ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ュ", "ゅ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ョ", "ょ");
UPDATE `_table_` SET _column_ = REPLACE(_column_,"ッ", "っ");

拍手[0回]

mysqli_insert_id

$id = mysqli_insert_id($db);

拍手[0回]

order by field

ORDER BY FIELD(id, 3, 5, 1, 2, 4) ASC|DESC

拍手[0回]

datetime ⇔ unixtime

MySQLにdatetime型で保存したデータをUNIX TIMEで取り出す

select unix_timestamp(hoge) as unix_hoge from hoge_data;

逆に、UNIX TIMEで保存したデータを、datetime型に変換する
「FROM_UNIXTIME」という関数。

select  from_unixtime(unix_hoge) as hoge;

拍手[0回]



忍者ブログ [PR]

graphics by アンの小箱 * designed by Anne