Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT INTO competitions (user_id, headline, description, start_date, end_date, competition_artwork)
- SELECT ${user_id}, ${headline}, ${description}, ${start_date}, ${end_date}, ${competition_artwork}
- WHERE NOT EXISTS
- ( SELECT DISTINCT competitions
- FROM competitions
- WHERE id = (SELECT MAX(id) FROM competitions) and user_id = ${user_id} and headline = ${headline} and description = ${description} and start_date = ${start_date} and end_date = ${end_date} and competition_artwork = ${competition_artwork}
- ) RETURNING *;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement