Tag Info

New answers tagged


If you just want to disambiguate two rows with similar content, you can use the ROWID functionality in SQLite3, which helps uniquely identify each row in the table. Something like this: DELETE FROM sms WHERE rowid NOT IN (SELECT min(rowid) FROM sms GROUP BY address, body); should work to get you the rows with the minimum rowid, which will be the first ...


The OP answered their own question in the comments (now deleted): Never mind I figured it out, using a unique index combo, ALTER TABLE files ADD UNIQUE INDEX (file_relation, file_relation_id, file_dimension) does the trick.


You should go with second option obviously for many reasons: Will you add user id again if you need to come up with an entity at same level of comment? May be it won't happen in your scenario, but still. Storage, as your database size grows There won't be performance impact much as your query is highly selective and if you have good index design.


In my opinion you should go with the second way, that's the INNER JOIN. Since , in my understanding, this won't be a critical query to the database (read intensive) this approach would be the best, for simplicity in development and makes for "good practice". Other than that the comments could be many, and retaining an extra user id would add few bytes at a ...

Top 50 recent answers are included