Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8334981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:31:32+00:00 2026-06-09T03:31:32+00:00

I am trying to execute the following statement: DELETE a FROM db.table1 a INNER

  • 0

I am trying to execute the following statement:

DELETE a
FROM db.table1 a
    INNER JOIN (SELECT domainname
                FROM db.table1
                WHERE domainname LIKE '%.uci.edu'
                GROUP BY keyvalue
                HAVING COUNT(1) > 1
        ) b ON a.id = b.id 

I got the error mentioned in my title. What I’m trying to achieve has been explained here: How to make the result of one query be in the NOT IN clause?

Please, help me to do this task. Why b.id is unknown ?? I have no experience in such type of Join. I understand joining two different tables, but for this statement can anybody explain please ? Please, note that the domainname is unique value. The primary key is the id and it is auto_increment but I don’t use it to differentiate between columns. I mainly use another value domainname_no which is unique.

EDIT: THE command above does not work.

what I need is the following :
I have a list of domain names. say: aa.yahoo.com, bb.yahoo.com, cc.yahoo.com, aa.msn.com. Each domain name has a key value. If the key is shared, I want to delete this record. So, I selected the distinct values grouped them by the key value. If the record in not in the distinct set, and have the same top level domain, then I don’t need it.

Example: My table:
cert_id | domainname | domain_certificate | key
1 | a.yahoo.com | a.yahoo.com_1 |5555
2 | a.yahoo.com | a.yahoo.com_2 |6666
3 | b.yahoo.com | b.yahoo.com_1 |5555
4 | b.yahoo.com | c.yahoo.com_2 |6666

each domain might have more than one certificate associated with key. If one or more certificate with different domain name have the same key, I want to delete it.

Now, I have two domain names which are a.yahoo.com and b.yahoo.comhave the same key. I need to delete b.yahoo.com and any domain name that have the same pattern like ‘%.yahoo.com’ and not equal to a.yahoo.com which is the distinct value.

Currently, what I’m doing is quering the distinct values:

select distinct domainname 
from db.table1
where domainname like '%.uci.edu'
group by keyvalue
order by domainname

Then delete any value that is not in the distinct list and have the same pattern %.yahoo.com

delete from db.table1 where domain not in ( I type the list of distinct domain 
names manually)
and domainanme like '%.yahoo.com';

i hope the problem is clear now.

But this command does not work. For details see: How to make the result of one query be in the NOT IN clause?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:31:33+00:00Added an answer on June 9, 2026 at 3:31 am

    you did not specify the ID for the SubQuery. Try this instead:

    DELETE a
    FROM db.table1 a
        INNER JOIN (SELECT id, domainname             -- added ID field
                    FROM db.table1
                    WHERE domainname LIKE '%.uci.edu'
                    GROUP BY keyvalue
                    HAVING COUNT(1) > 1
            ) b ON a.id = b.id                        -- ID was used here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute the following SQL: SELECT * FROM Table2 INNER JOIN (SELECT
I have the following sql statement: SELECT COUNT(table2.programName), table2.programName FROM table1 LEFT JOIN table2
I am trying to execute following query: Insert into pligg_links_temp select * from pligg_links
I am trying to do the following query: cursor.execute(SELECT DISTINCT(provider) FROM raw_financials WHERE vendor_id=%s
Trying to do a select statement from a MySql database. The following works when
I am trying to execute the following Query select distinct pincode as Pincode,CAST(Date_val as
I'm trying to execute a script from within my java code which looks like:
I'm trying to execute the following SQL statement (built and tested in SQL Server
I simply want to execute the following Mysql statement SET @a = 1;SELECT @a;
I'm getting an error in the following OPENQUERY statement that I'm trying to execute

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.