Created
July 4, 2017 17:47
-
-
Save FrankV01/d8595ea3f80bf9297989a9f372015bda to your computer and use it in GitHub Desktop.
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
client.query('SELECT NOW() as now', (err, res) => { | |
if (err) { | |
console.log(err.stack) | |
} else { | |
const targetDate = res.rows[0]; | |
client.query(`SELECT * from myTable where lastCreated > ${res.rows[0]}`, (er2, res2) => { | |
//This, in theory could go on a bit. Note that this is a contrived example and in the case | |
// of SQL, you'd use the proper joins and conditionals in one statement. | |
}) | |
} | |
}) | |
// promise | |
client.query('SELECT NOW() as now') | |
.then(res => console.log(res.rows[0])) | |
.catch(e => console.error(e.stack)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment