Need help in qriting mysql query

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

Need help in qriting mysql query

Post by eshban »

Hello,

Can anyone please help me in writing one query

Suppose today is 07th September 2007 and day is FRIDAY.

So on the base of today(which is friday), i want to get all Dates of Previous month friday's

so result should be

03-08-2007 - Friday
10-08-2007- Friday
17-08-2007- Friday
24-08-2007- Friday
31-08-2007- Friday

OR

if today is 09h September 2007 and day is Sunday.
So on the base of today(which is Sunday), i want to get all Dates of Previous month Sunday's

so result should be
05-08-2007 - Sunday
12-08-2007 - Sunday
19-08-2007 - Sunday
26-08-2007 - Sunday

please help that how to write mysql query of this
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

You may use date_format() with %W
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply