{"id":7754,"date":"2020-06-15T11:48:52","date_gmt":"2020-06-15T10:48:52","guid":{"rendered":"http:\/\/help.sdna.lu\/?p=7754&#038;lang=en"},"modified":"2022-12-18T11:12:32","modified_gmt":"2022-12-18T10:12:32","slug":"query-address-lprimarykey","status":"publish","type":"post","link":"https:\/\/sdna.lu\/?p=7754","title":{"rendered":"Query Address LPrimaryKey"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><code>Select * from [Address] where convert(varchar, [DBId]) \n+ '-' + convert(varchar, [CompanyId]) + '-' + convert(varchar, [PersonId]) + '-' + [Name] + '-' + convert(varchar, [AddressTypeId]) \n+ '-' + Format([StartDate], 'yyyyMMdd') in (Select convert(varchar, [DBId]) + '-' + convert(varchar, [CompanyId]) + '-' + convert(varchar, [PersonId]) + '-' + [Name] + '-' + convert(varchar, [AddressTypeId]) \n+ '-' + Format([StartDate], 'yyyyMMdd') as [ResField] from [Address] Group by [DBId], [CompanyId], [PersonId], [Name], [AddressTypeId], [StartDate] having count(*) &gt; 1) <\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Select * from [Address] where convert(varchar, [DBId]) + &#8216;-&#8216; + convert(varchar, [CompanyId]) + &#8216;-&#8216; + convert(varchar, [PersonId]) + &#8216;-&#8216; + [Name] + &#8216;-&#8216; + convert(varchar, [AddressTypeId]) + &#8216;-&#8216; + Format([StartDate], &#8216;yyyyMMdd&#8217;) in (Select convert(varchar, [DBId]) + &#8216;-&#8216; + convert(varchar, [CompanyId]) + &#8216;-&#8216; + convert(varchar, [PersonId]) + &#8216;-&#8216; + [Name] + &#8216;-&#8216; + convert(varchar, [AddressTypeId]) + [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[487],"tags":[],"class_list":["post-7754","post","type-post","status-publish","format-standard","hentry","category-query"],"_links":{"self":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts\/7754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7754"}],"version-history":[{"count":2,"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts\/7754\/revisions"}],"predecessor-version":[{"id":7756,"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts\/7754\/revisions\/7756"}],"wp:attachment":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}