当我在sqlite数据库中插入超过500条记录时,会出现“化合物SELECT
中的术语太多”错误。我已阅读有关sqlite limit
现在我想在数据库中插入1000多条(比如2000个产品)记录。任何人都可以建议,如何编写查询以插入超过1000条记录。
这是我使用的插入查询:
INSERT INTO Product
SELECT
'4886229673836544' AS productId,
'Pen1' AS productName,
'10' As sellingPrice
UNION SELECT
'4780676557570048',
'Pen2', '10'...........
UNION SELECT
'4562973255270400',
'Pen1000',
'10'
答案 0 :(得分:0)
创建如下参数化查询:
create statement
add parameter definitions to parameter collection
prepare statement
start transaction
for each row you want to insert
set parameter values
execute statement
commit transaction
并按以下方式使用它(伪代码):
select p.*
from property p
join property_detail d on (p.Id = d.property_id)
join property_detail d1 on (p.Id = d1.property_id)
where p.status=1
and d.param='parking' and d.value='car-parking'
and d1.param='furnishing' and d1.value='semi-furnished';