<br />
<b>Notice</b>:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>redux-framework</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in <b>/home/ahmetozg/blog/wp-includes/functions.php</b> on line <b>6131</b><br />
<br />
<b>Notice</b>:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>di-blocks</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in <b>/home/ahmetozg/blog/wp-includes/functions.php</b> on line <b>6131</b><br />
<br />
<b>Notice</b>:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>insert-headers-and-footers</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in <b>/home/ahmetozg/blog/wp-includes/functions.php</b> on line <b>6131</b><br />
<br />
<b>Notice</b>:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>voice</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in <b>/home/ahmetozg/blog/wp-includes/functions.php</b> on line <b>6131</b><br />
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>t-sql &#8211; Ahmet Özgün Özcan</title>
	<atom:link href="https://blog.ahmetozgunozcan.com.tr/tag/t-sql/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.ahmetozgunozcan.com.tr</link>
	<description>Ahmet Özgün Özcan Blog</description>
	<lastBuildDate>Sat, 04 Dec 2021 04:34:57 +0000</lastBuildDate>
	<language>tr</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.2</generator>
	<item>
		<title>rows unbounded preceding</title>
		<link>https://blog.ahmetozgunozcan.com.tr/rows-unbounded-preceding/</link>
					<comments>https://blog.ahmetozgunozcan.com.tr/rows-unbounded-preceding/#respond</comments>
		
		<dc:creator><![CDATA[Ahmet Özgün ÖZCAN]]></dc:creator>
		<pubDate>Mon, 28 Oct 2019 20:47:14 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[t-sql]]></category>
		<guid isPermaLink="false">https://blog.ahmetozgunozcan.com.tr/?p=995</guid>

					<description><![CDATA[Bir veri seti içerisinde herhangi bir sayısal kolonun kumülatif toplamına ihtiyacımız olabilir. Böyle bir problem için aşağıdaki yöntemlerle çözüm bulanları gördüm. Küçük bir kod parçacığı ile bir önceki satırın verisini toplayarak yeni bir kolona yazılması, Tabloya bir sıra veri her bir satırı kendinden önce gelen satır ile bağlayıp toplama işlemi yapma. İşte tam bu noktada [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Bir veri seti içerisinde herhangi bir sayısal kolonun kumülatif toplamına ihtiyacımız olabilir. Böyle bir problem için aşağıdaki yöntemlerle çözüm bulanları gördüm.</p>



<ul><li>Küçük bir kod parçacığı ile bir önceki satırın verisini toplayarak yeni bir kolona yazılması,</li><li>Tabloya bir sıra veri her bir satırı kendinden önce gelen satır ile bağlayıp toplama işlemi yapma.</li></ul>



<p>İşte tam bu noktada <strong>“rows unbounded preceding” </strong>kullanarak SQL cümlesini basitçe tamamlayabiliriz.</p>



<p>Aşağıdaki gösterilen şekilde bir veri setimiz olsun.</p>



<figure class="wp-block-image is-style-default"><img decoding="async" src="https://cdn-images-1.medium.com/max/800/1*lL3oFmesaYCsTEF7q7j4qw.jpeg" alt=""/></figure>



<p>Şimdi yazmış olduğumuz bu SQL cümleciği ile her bir satırdaki <strong>SAYI </strong>değeri ile bir üst satırdaki <strong>TOPLAM </strong>değerinin toplanması sonucu oluşan veri setini oluşturalım.</p>



<figure class="wp-block-image is-style-default"><img decoding="async" src="https://cdn-images-1.medium.com/max/800/1*zw9o1IkcevFJm2tgTWeAOQ.jpeg" alt=""/></figure>



<p>Şimdi yazmış olduğumuz bu SQL cümleciği ile <strong>grup bazında</strong> her bir satırdaki <strong>Sayı</strong> değeri ile bir üst satırdaki <strong>Toplam </strong>değerinin toplanması sonucu oluşan veri setini oluşturalım.</p>



<figure class="wp-block-image is-style-default"><img decoding="async" src="https://cdn-images-1.medium.com/max/800/1*zGPZe_f9uZOep2cV-bboMw.jpeg" alt=""/></figure>



<p>!Ayrica ORDER BY ifadesi çok önemlidir. Çünkü vermis oldugunuz <strong>siralama ile </strong>kümülatif toplama islemi gerçekleşmektedir.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.ahmetozgunozcan.com.tr/rows-unbounded-preceding/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>T-SQL TreePath Oluşturma</title>
		<link>https://blog.ahmetozgunozcan.com.tr/t-sql-treepath-olusturma/</link>
					<comments>https://blog.ahmetozgunozcan.com.tr/t-sql-treepath-olusturma/#respond</comments>
		
		<dc:creator><![CDATA[Ahmet Özgün ÖZCAN]]></dc:creator>
		<pubDate>Sun, 27 Oct 2019 07:35:31 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[t-sql]]></category>
		<guid isPermaLink="false">https://blog.ahmetozgunozcan.com.tr/?p=990</guid>

					<description><![CDATA[Tabloda hiyerarşik olarak birbirinie bağlı kayıtları tutan bir veri örneği bulunmaktadır. Hiyerarşi kavramı bize, verinin bütününün bir ağaç yapısı (tree) olduğunu bildirir.&#160; Bu örnegimizde herhangi bir satirin adini üst seviyedeki satirlarin adlari ile birlestirerek gösterecegiz. Yani ağacın dallarını birleştireceğiz.&#160; Örnegin Id si 4 olan satir için&#160;; “Parent 1 -&#62; Child 1.1 -&#62; Child 1.1.1” degerini, [&#8230;]]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image is-style-default"><img decoding="async" src="https://cdn-images-1.medium.com/max/800/1*ZwXohJc7xTrPnoo94bF_Vw.jpeg" alt=""/></figure>



<p>Tabloda hiyerarşik olarak birbirinie bağlı kayıtları tutan bir veri örneği bulunmaktadır. Hiyerarşi kavramı bize, verinin bütününün bir ağaç yapısı (tree) olduğunu bildirir.&nbsp;</p>



<p>Bu örnegimizde herhangi bir satirin adini üst seviyedeki satirlarin adlari ile birlestirerek gösterecegiz. Yani ağacın dallarını birleştireceğiz.&nbsp;</p>



<p><strong>Örnegin</strong></p>



<ul><li>Id si 4 olan satir için&nbsp;; “Parent 1 -&gt; Child 1.1 -&gt; Child 1.1.1” degerini,</li><li>Id si 2 olan satir için&nbsp;; “Parent 1 -&gt; Child 1.1” degerini</li><li>Id si 1 olan satir için&nbsp;; “Parent 1” degerini</li></ul>



<p>elde etmeliyiz.</p>



<p>Bunun için asagidaki SQL Scripti kullanabiliriz.</p>



<p></p>



<pre class="EnlighterJSRAW" data-enlighter-language="sql" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">WITH p AS
(
SELECT Id,ParentId,Ad,cast(Ad as varchar(max)) as treepath
FROM ParentChild WHERE parentID is null
UNION ALL
SELECT c.Id,c.ParentId,c.Ad,cast(p.treepath +'->'+cast(c.Ad as varchar(max)) as varchar(max)) as nihaipath
FROM ParentChild c JOIN p ON p.Id = c.ParentId
)
SELECT * FROM p</pre>



<p></p>



<p><strong><em>Sonuç</em></strong></p>



<h3 class="wp-block-heading"><img decoding="async" fetchpriority="high" src="https://blog.ahmetozgunozcan.com.tr/wp-content/uploads/2019/10/t-sql-treepath-olusturma-02.jpg" alt="" width="350" height="163"></h3>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.ahmetozgunozcan.com.tr/t-sql-treepath-olusturma/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
