Delete a Select Inner Join Query result

47
November 17, 2021, at 3:50 PM
SELECT yturl from ytpointadder a
JOIN watched b on b.watchedyt = a.yturl AND b.ip = a.ip
Group by a.ip;

I want to delete the result of the query for exp this query result is :

yturl ip id
eY5WRONGXDI 197.XX.XX.XXX 1

Though i want to delete it from ytpointadder. I tried :

DELETE from ytpointadder a
JOIN watched b on b.watchedyt = a.yturl AND b.ip = a.ip
Group by a.ip;
Answer 1

You can't specify same target table for update (delete) in FROM clause. So you have to use another outer query.

Try:

DELETE FROM ytpointadder
WHERE yturl IN  ( SELECT t.yturl FROM (SELECT a.yturl, a.ip from ytpointadder a
                                     JOIN watched b on b.watchedyt = a.yturl AND b.ip = a.ip
                                     Group by a.ip 
                                     ) as t 
                 ) ;
Answer 2

In a partial query, it should return one column You may need to use parentheses

try this

DELETE FROM ytpointadder
WHERE yturl IN
( 
SELECT a.yturl from  ytpointadder a
JOIN watched b on b.watchedyt = a.yturl AND b.ip = a.ip
Group by a.ip)
READ ALSO
How to create Form from Json schema and Ui schema in Android Kotlin

How to create Form from Json schema and Ui schema in Android Kotlin

How to create Form from Json schema and Ui schema in Android Kotlin? I am new to mobile development and am a little bit confused how to do this in Jetpack Compose appI find many ways to create a form in React

60
How would I automatically update html links if image location is physically moved?

How would I automatically update html links if image location is physically moved?

I've always used Dreamweaver and if I link to, say, an image and then subsequently physically move the location of that image (within the Dreamweaver environment) Dreamweaver automatically updates the link in the codeSo, I have an image in index

45
laravel {{ $loop->index }} & jquery count++

laravel {{ $loop->index }} & jquery count++

Using the Laravel blade template, is there a way to include a variable and increase each time in the foreach, or what is the better approach?

49
How to create overlapping images using CSS

How to create overlapping images using CSS

I have created 5 images overlapping each other but I am stuck on this part ("Whenever the mouse is placed over any of the images that image must move to the front of the group and be the primary image on displayWhen the mouse has pulled away the image will return...

34