sql server - Identifying the unique values that form part of a SQL sum query -
I have 2 questions that I would like to work together:
1) A question of geometry The number is within a certain distance of another and the result is only where the count is more than 6 digits;
2) A query returns unique IDs for all points within that distance (without any counting and without at least records)
I generate a single query All (and only) records are expressed in the first query, which will be Obviously, the system is identifying the record to count them, so I think it is possible to ask which records are they? | The second question rejects the result. Should I structure it as a sub-query and if so, how do I do it? The question is 1: query is 2: Yes, a sub The query will work: t2 from the
DECLARE @radius float = 50 SELECT t1.new_ref, t1.hatrisref, SUM (case when t1.geolocation.STDistance (t2.Geolocation) And lt; = @ radius then 1 other zeros) Group size 'Table 1 to T1, Table 1 T2, WHERE [t1]. [[new2ref]! = [T2]. [New_f] Group by [T1]. [New_fiber], [t1]. [Hatric] HOWING SUM (In case T1. Zolocation. STDSTANCE (T2 geolocation) and LT; = @ RDS 1 rest 0) Order order by [T1]. [New_f], [T1]. [Hatric]
select float = 50 as radius @ radius, t1.hatrisref, t1.new_ref, t2. From new_ref to Table 1 T1, WHERE [t1] as Table 1 T2. [New_ref]! = [T2]. [New_ref] and t1.geolocation.STDistance (t2.Geolocation) & lt; = @radius GROUP BY [t1]. [New_ref], [T1]. [Hetricef], T2. EnVE_f ORDER by [T1]. [Haatrisf], [T1]. [New_f], T2
Comments
Post a Comment