<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: SQL Puzzle: SQL Advance Query &#8211; Get the Last Sunday of Previous Week	</title>
	<atom:link href="https://www.dbrnd.com/2018/11/sql-puzzle-sql-advance-query-get-the-last-sunday-of-previous-week/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com/2018/11/sql-puzzle-sql-advance-query-get-the-last-sunday-of-previous-week/</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Wed, 14 Aug 2019 09:14:32 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>
		By: Nikhil Bhosale		</title>
		<link>https://www.dbrnd.com/2018/11/sql-puzzle-sql-advance-query-get-the-last-sunday-of-previous-week/#comment-7672</link>

		<dc:creator><![CDATA[Nikhil Bhosale]]></dc:creator>
		<pubDate>Wed, 14 Aug 2019 09:14:32 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7431#comment-7672</guid>

					<description><![CDATA[Declare @date date = &#039;2019-08-18&#039;;
Declare @day int;
Declare @diff int;
SELECT @day = DATEPART(WEEKDAY, @date);
Set @diff = @day-1;

SELECT DATEADD(day, -@diff, @date) AS LastSundayDate]]></description>
			<content:encoded><![CDATA[<p>Declare @date date = &#8216;2019-08-18&#8217;;<br />
Declare @day int;<br />
Declare @diff int;<br />
SELECT @day = DATEPART(WEEKDAY, @date);<br />
Set @diff = @day-1;</p>
<p>SELECT DATEADD(day, -@diff, @date) AS LastSundayDate</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: HIC		</title>
		<link>https://www.dbrnd.com/2018/11/sql-puzzle-sql-advance-query-get-the-last-sunday-of-previous-week/#comment-6959</link>

		<dc:creator><![CDATA[HIC]]></dc:creator>
		<pubDate>Mon, 08 Apr 2019 17:57:11 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7431#comment-6959</guid>

					<description><![CDATA[SELECT NEXT_DAY(SYSDATE - 8, &#039;воскресенье&#039;)
FROM dual;]]></description>
			<content:encoded><![CDATA[<p>SELECT NEXT_DAY(SYSDATE &#8211; 8, &#8216;воскресенье&#8217;)<br />
FROM dual;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dinesh		</title>
		<link>https://www.dbrnd.com/2018/11/sql-puzzle-sql-advance-query-get-the-last-sunday-of-previous-week/#comment-6791</link>

		<dc:creator><![CDATA[Dinesh]]></dc:creator>
		<pubDate>Thu, 22 Nov 2018 07:17:24 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7431#comment-6791</guid>

					<description><![CDATA[;
WITH CTE
As
(Select DateAdd(Week,-1,@MyDate) As MyDate
Union All
Select DateAdd(Day,1,MyDate)
From CTE
Where MyDate&#060;@MyDate)
Select * From CTE
Where DateName(DW,MyDate)=&#039;Sunday&#039; And MyDate&#060;@MyDate]]></description>
			<content:encoded><![CDATA[<p>;<br />
WITH CTE<br />
As<br />
(Select DateAdd(Week,-1,@MyDate) As MyDate<br />
Union All<br />
Select DateAdd(Day,1,MyDate)<br />
From CTE<br />
Where MyDate&lt;@MyDate)<br />
Select * From CTE<br />
Where DateName(DW,MyDate)=&#039;Sunday&#039; And MyDate&lt;@MyDate</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
