Questions tagged [exists]

The tag has no usage guidance.

10 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
0 answers
166 views

"FOR UPDATE" in an "EXISTS SELECT" statement

Is there any potential problem in using (in a transaction) SELECT EXISTS( SELECT * FROM mytable WHERE id=36 FOR UPDATE ) i.e. having SELECT ... FOR UPDATE within an EXISTS? MySQL does certainly ...
Déjà vu's user avatar
  • 463
1 vote
1 answer
308 views

Inconsistent results with MySQL, query never ends on MariaDB

We have some really strange behaviour on MySQL (8.0.29) that we can't explain. We have 2 tables + 1 link table in-between, illustrated by this schema : We run a query whereby we need to fetch the id ...
wimg's user avatar
  • 107
1 vote
1 answer
122 views

Weird error on creating table and selecting rows from table

I have db and I am trying to create table called "sales_invoice_grid" I am having bellow scenarios: error 1: while creating the table "sales_invoice_grid" manually, it gives the message that it ...
1990rk4's user avatar
  • 111
0 votes
0 answers
26 views

IF EXISTS doesn't stop errors on RDS Postgres 11.19 instance

Recently one of our RDS Postgres databases was upgraded to version 11.19. Since then, we're receiving errors when running a database migration. I can't replicate this issue locally, it appears to be ...
Ben Hitchcock's user avatar
0 votes
2 answers
33 views

I have a database with a player, tournament, and registration table. I need to query all players that played in 2 types (attributes) of tournaments

I currently have two tournaments that have matches. Wimbledon and Atlanta open which I have one as a grand slam and the other as a masters 1000, and I want to get the players who played in both This ...
zaria palmer's user avatar
0 votes
1 answer
477 views

Select only those records that have same multiple values for a particular column if it's existing?

Below is an example of my pricing_supports table have more than 3 milions rows. There some rows having same values in the first_origin_id, delivery_id fields. If there're records with same ...
Dương Khoa's user avatar
0 votes
0 answers
61 views

Executing IF Exists condition

I have a sproc that scripts out permissions and in the process, I add a check to see if the object exists before dumping the results into a table. Then, I have another re-assign permissions sproc that ...
Laurent's user avatar
  • 73
0 votes
2 answers
3k views

Select Data from two tables ONLY IF ID on both tables are SAME

I need to select returns result SELECT wl.id FROM wishlist AS wl LEFT JOIN wishlist_products AS wp ON wl.id = wp.wishlist_id Only IF ALL of wp.product_id EXISTS in wishlist_products_bought....
andrei_sharov's user avatar
-1 votes
1 answer
37 views

How to check existence of a value in between two columns of the same table

I have a table bills having columns id, starting_bl_no, ending_bl_no. How can I check a new bill number input is already exist in the table? id starting_bl_no ending_bl_no 1 100 ...
Navaneet Raman Bhaskar's user avatar
-1 votes
2 answers
111 views

MYSQL get rows not axisting in other table

I have two tables with 1 identical data column for comparison. One table "species" is a wide list of species and each data row has one unique id called "suid" add. to its primary ...
BigMac's user avatar
  • 1