SEARCH
TOOLBOX
LANGUAGES
Sql

Sql

From Chaehyun

(Difference between revisions)
Jump to: navigation, search
(Created page with "= sql = * INSERT IGNORE INTO user_log (user_id, item_id, date_created, tag) SELECT a.id, b.code, b.date, 'like' FROM user_id a, review b WHERE a.author=b.author AND b.point >= 7;")
(update)
 
(3 intermediate revisions not shown)
Line 1: Line 1:
-
= sql =
+
= join =
* INSERT IGNORE INTO user_log (user_id, item_id, date_created, tag) SELECT a.id, b.code, b.date, 'like' FROM user_id a, review b WHERE a.author=b.author AND b.point >= 7;
* INSERT IGNORE INTO user_log (user_id, item_id, date_created, tag) SELECT a.id, b.code, b.date, 'like' FROM user_id a, review b WHERE a.author=b.author AND b.point >= 7;
 +
 +
= update =
 +
* UPDATE TBL_MENU AS a SET CNT = (SELECT COUNT(*) FROM TBL_ORDER_DETAIL WHERE MN_IDX = a.MN_IDX);
 +
 +
= on duplicate key update =
 +
* insert into ITEM_RECO2 (reco_id, service_id, last_updated) values('00000ded874a175e', 4, '2013-03-20 02:12:12'), ('0000000000', 4, '2013-03-20 02:12:12'), ('0000106d0c44711d', 4, '2013-03-20 02:12:12') ON DUPLICATE KEY UPDATE last_updated='2016-03-20 02:12:12';

Latest revision as of 02:39, 20 March 2013

join

  • INSERT IGNORE INTO user_log (user_id, item_id, date_created, tag) SELECT a.id, b.code, b.date, 'like' FROM user_id a, review b WHERE a.author=b.author AND b.point >= 7;

update

  • UPDATE TBL_MENU AS a SET CNT = (SELECT COUNT(*) FROM TBL_ORDER_DETAIL WHERE MN_IDX = a.MN_IDX);

on duplicate key update

  • insert into ITEM_RECO2 (reco_id, service_id, last_updated) values('00000ded874a175e', 4, '2013-03-20 02:12:12'), ('0000000000', 4, '2013-03-20 02:12:12'), ('0000106d0c44711d', 4, '2013-03-20 02:12:12') ON DUPLICATE KEY UPDATE last_updated='2016-03-20 02:12:12';
Retrieved from "http://chaehyun.kr/w/Sql"