且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SQL Server查询返回太多记录

更新时间:2023-02-05 16:17:26

之所以返回太多记录是因为您的查询会生成两个表的笛卡尔积.您需要告诉服务器这两个表如何相互关联.

The reason why you are returning too many records is because your query produces cartesian product of both tables. You need to tell the server on how the two tables are related with each other.

SELECT  AankopenReparaties.Id,
        AankopenReparaties.KlantenId,
        AankopenReparaties.actietype,
        AankopenReparaties.voorwerptype,
        laptopscomputers.merk,
        laptopscomputers.model,
        laptopscomputers.info,
        AankopenReparaties.info,
        AankopenReparaties.Prijs,
        AankopenReparaties.lopend
FROM    AankopenReparaties
        INNER JOIN laptopscomputers
            ON AankopenReparaties.LaptopID = laptopscomputers.ID -- specify relationship
WHERE   aankopenreparaties.lopend = 'lopend'

要进一步获得有关联接的知识,请访问下面的链接:

To further gain more knowledge about joins, kindly visit the link below: