Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for WHERE NOT EXISTS #800

Closed
nremond opened this issue May 8, 2014 · 7 comments
Closed

Support for WHERE NOT EXISTS #800

nremond opened this issue May 8, 2014 · 7 comments

Comments

@nremond
Copy link
Contributor

nremond commented May 8, 2014

It would be nice to be able to do some conditional inserts.

For example, if we have the following table:

    +----------+----------+
    | user_id  | store_id |
    +----------+----------+
    |    39    |    8     |
    |    8     |    39    |
    |    5     |    11    |
    +----------+----------+

I would like to be able to run the following query:

INSERT INTO favorite_store (user_id, store_id) VALUES (39, 8)
WHERE NOT EXISTS 
    (SELECT * FROM favorite_store WHERE user_id = 39 AND store_id = 8)
@neelvk
Copy link

neelvk commented May 9, 2014

I would love to have this functionality. Currently, I am doing a query to figure out if I am about to insert a duplicate...

@szeiger
Copy link
Member

szeiger commented May 9, 2014

#782 should take care of some of these use cases, although explicit primary keys (not defined via O.PrimaryKey) are still somewhat broken (in general, not just for insertOrUpdate) and it doesn't address the issue for non-pk columns at all.

@cvogt cvogt added this to the 2.2 milestone May 9, 2014
@cvogt
Copy link
Member

cvogt commented May 9, 2014

lets look into it for 2.2, but low priority

@szeiger szeiger modified the milestones: Future, 3.0.0 Jan 28, 2015
@erdebee
Copy link

erdebee commented Aug 12, 2015

+1, I'd like to see this in the DSL very much!

@hvesalai hvesalai removed the 1 - Ready label Mar 7, 2018
@nikkatalnikov
Copy link

any progress on this issue?

@hvesalai
Copy link
Member

hvesalai commented Jun 6, 2019

It's in the feature ideas box, so it is waiting for community contributions. If you would like to work on it, it is up for grabs.

@sebastianrozyczka
Copy link

@nremond Very old thread, but this is now supported by the slick API, so the issue can be closed so as not to confuse anyone :)

@nafg nafg closed this as completed Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants