Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT a.tabl1, b.tabl2, c.tabl3
- INTO OUTFILE 'H:/output/output.csv'
- fields TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY 'n'
- FROM a, b, c
- INNER JOIN a.tabl1 ON a.id = b.id
- INNER JOIN b.tabl2 ON b.id = c.id
- WHERE
- (
- b.case_txt = 'case1' OR
- b.case_txt = 'case2' OR
- b.case_txt = 'case3' OR
- )
- AND
- c.address != ''
- AND
- c.state = 'OR'
- AND
- date LIKE '%02/01/13%';
- SELECT a.*, b.*, c.*
- INTO OUTFILE 'H:/output/output.csv'
- fields TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY 'n'
- FROM tabl1 a
- INNER JOIN tabl2 b ON a.id = b.id
- INNER JOIN tabl3 c ON b.id = c.id
- WHERE
- (
- b.case_txt = 'case1' OR
- b.case_txt = 'case2' OR
- b.case_txt = 'case3'
- )
- FROM a, b, c -- cartesian product of these three tables joined with
- INNER JOIN a.tabl1 ON a.id = b.id -- nonexisting tables a.tabl1 (table tabl1 in db a)
- INNER JOIN b.tabl2 ON b.id = c.id -- and tabl2 in database b
- FROM a
- INNER JOIN b ON a.id = b.id
- INNER JOIN c ON b.id = c.id
- SELECT *
- INTO OUTFILE 'H:/output/output.csv'
- fields TERMINATED BY ','
- OPTIONALLY ENCLOSED BY '"'
- LINES TERMINATED BY 'n'
- FROM tabl1 AS a
- INNER JOIN tabl2 AS b
- ON a.id = b.id
- INNER JOIN tabl3 AS c
- ON b.id = c.id
- WHERE (
- b.case_txt = 'case1' OR
- b.case_txt = 'case2' OR
- b.case_txt = 'case3'
- )
- AND c.address != ''
- AND c.state = 'OR'
- AND date LIKE '%02/01/13%';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement