正确的SQL语句,用于在特殊情况下复制项目

时间:2018-09-25 07:36:27

标签: sql reactjs sqlite duplicates db-browser-sqlite

SampleImage.jpg

必须显示图片中的所有检查项目。

这是我的sql语句。

SELECT DISTINCT 
    c.code || ' - ' || c.description || ' - ' || s.num AS SearchColumn, 
    s.num AS Num,
    c.code AS Code,
    c.product AS Product,
    f.faciltyname AS FacilityName,
    f.facilityid AS FacilityID,  
    c.description AS Description,  
    c.Number AS Num
FROM Facility f 
    JOIN Code c ON f.codeid = c.codeid
    JOIN Structure s ON c.structureid = s.structureid 
WHERE searchcolumn > "" 
    AND ((c.product = 'PROD1' OR c.product IS NULL )) 
ORDER BY c.code ASC 

它们只是从代码,num和productid(它们也有特殊情况)中复制而来,但实际上它们具有所需的不同的工具ID和工具名称

0 个答案:

没有答案