【发布时间】:2023-03-03 14:22:01
【问题描述】:
我想在现有文件夹/项目下提交一份新报告。
新报告查询如下:
select o.companycode, o.name, w.StartTravelTime, w.DateAndTimeStart, w.DateAndTimeEnd, w.InspectionID , w.Longitude as 'GPSLongitude', w.Latitude as 'GPSLongitude', o.Longitude, o.Latitude, ACOS(SIN(PI()*w.Latitude/180.0)*SIN(PI()*o.Latitude/180.0)+COS(PI()*w.Latitude/180.0)*COS(PI()*o.Latitude/180.0)*COS(PI()*o.Longitude/180.0-PI()*w.Longitude/180.0))*6371 as 'Afwijking in km'
from Anticimex_WorkRecords w,
CRM_Organisations o,
Anticimex_Inspections i,
Users u
where w.InspectionID = i.id
and i.BrancheOrganisationID = o.id
and u.id = w.userid
and w.DateAndTimeStart between @Param3 and @Param4
and u.username = @Param5
如果我想继续,我会收到以下错误:'保存查询设计方法时发生错误。已添加具有相同密钥的项目。'
【问题讨论】:
-
您使用的是哪个 dbms? (上述查询是特定于产品的。)
-
今日提示:始终使用现代、明确的
JOIN语法。更容易编写(没有错误),更容易阅读和维护,如果需要更容易转换为外连接! -
sql server 管理工作室。如果我在那里运行查询,它就可以正常工作。
-
SSMS 是一种管理工具,而不是数据库。这意味着您正在使用 SQL Server。该错误抱怨报告,而不是查询
-
我会删除数据集并重新开始。听起来您正在尝试向数据集的字段定义添加一个字段,但该字段已被定义。
标签: sql sql-server visual-studio-2010