Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE audit_trail (
- old_email TEXT NOT NULL,
- new_email TEXT NOT NULL
- );
- INSERT INTO audit_trail(old_email, new_email)
- VALUES ('harold_gim@yahoo.com', 'hgimenez@hotmail.com'),
- ('hgimenez@hotmail.com', 'harold.gimenez@gmail.com'),
- ('harold.gimenez@gmail.com', 'harold@heroku.com'),
- ('foo@bar.com', 'bar@baz.com'),
- ('bar@baz.com', 'barbaz@gmail.com');
- with iter2 as (
- with iter1 as (
- select old_email, new_email from audit_trail where old_email = 'harold_gim@yahoo.com'
- ) select a.old_email, a.new_email from audit_trail a join iter1 b on (a.old_email = b.new_email)
- ) select * from iter1 union iter2;
- ERROR: syntax error at or near "iter2" at character 264
- STATEMENT: with iter2 as (
- with iter1 as (
- select old_email, new_email from audit_trail where old_email = 'harold_gim@yahoo.com'
- ) select a.old_email, a.new_email from audit_trail a join iter1 b on (a.old_email = b.new_email)
- ) select * from iter1 union iter2;
- ERROR: syntax error at or near "iter2"
- LINE 5: ) select * from iter1 union iter2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement