Created
April 12, 2012 03:37
-
-
Save hidayat365/2364464 to your computer and use it in GitHub Desktop.
Output MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D:\xampp\mysql\bin>mysql -u root | |
Welcome to the MySQL monitor. Commands end with ; or \g. | |
Your MySQL connection id is 6 | |
Server version: 5.5.16 MySQL Community Server (GPL) | |
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. | |
Oracle is a registered trademark of Oracle Corporation and/or its | |
affiliates. Other names may be trademarks of their respective | |
owners. | |
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. | |
mysql> use test; | |
Database changed | |
mysql> create table table_1 as | |
-> select 'MM001' noid, 'Andi' nama union all | |
-> select 'MM002' noid, 'Santi' nama ; | |
Query OK, 2 rows affected (1.00 sec) | |
Records: 2 Duplicates: 0 Warnings: 0 | |
mysql> create table table_2 as | |
-> select 'MM001' noid, '2012-02-28' tgl_beli union all | |
-> select 'MM002' noid, '2012-02-28' tgl_beli union all | |
-> select 'MM002' noid, '2012-03-30' tgl_beli ; | |
Query OK, 3 rows affected (0.18 sec) | |
Records: 3 Duplicates: 0 Warnings: 0 | |
mysql> select table_1.* | |
-> from table_1 | |
-> left join ( | |
-> select * from table_2 | |
-> where tgl_beli between '2012-03-01' and '2012-04-01' | |
-> ) table_2tmp | |
-> on table_1.noid = table_2tmp.noid | |
-> where table_2tmp.noid is null; | |
+-------+------+ | |
| noid | nama | | |
+-------+------+ | |
| MM001 | Andi | | |
+-------+------+ | |
1 row in set (0.04 sec) | |
mysql> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment