简体   繁体   English

从 excel 文件列表中删除具有特定值的 SQL 行

[英]Delete SQL rows with specific values from excel file list

I want to make an SQL query.我想做一个 SQL 查询。 I want to delete all the rows that include a specific email address.我想删除包含特定电子邮件地址的所有行。 The string with the email addresses will load from an excel file.带有电子邮件地址的字符串将从 Excel 文件中加载。 Instead of having to write the emails one by one like shown below:不必像下图那样一一写邮件:

DELETE FROM Table1
WHERE email ('aaa@aaa.com', 'bbb@bbb.com')

I would like to load the string using the excel file (.xlsx, .csv or any other filetype) where the email addresses are written.我想使用写入电子邮件地址的 excel 文件(.xlsx、.csv 或任何其他文件类型)加载字符串。

LOAD * FROM excelfile.xlsx

or even load cell values from a specific column甚至来自特定列的负载单元值

If you need to do this operation once, you can write a query in EXCEL, multiply it to all your lines and then copy-paste and execute your query.如果您需要执行一次此操作,您可以在 EXCEL 中编写一个查询,将其乘以所有行,然后复制粘贴并执行您的查询。

Write EXCEL formula in the free row:在空闲行写EXCEL公式:

="DELETE FROM TABLE1 WHERE email  = '"&RC[-1]&"'"

从excel查询

Drag it to all your data, and you will get SQL query:将其拖到所有数据中,您将获得 SQL 查询:

DELETE FROM TABLE1 WHERE email  = 'aaa@aaa.com' 
DELETE FROM TABLE1 WHERE email  = 'bbb@bbb.com'

Then copy/paste and execute your query然后复制/粘贴并执行您的查询

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM