Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (19 June 2013 - 02:28 PM) Long Life To Asta New Era
@  agyat : (19 June 2013 - 01:58 PM) New Era Start At Asta Or Asta Start In New Era. :unsure:
@  yordan : (16 June 2013 - 05:41 PM) You're Welcome, Agyat!
@  agyat : (16 June 2013 - 07:38 AM) Thanks Yordan...
@  velma : (16 June 2013 - 12:06 AM) I Have Asked Opa To Check For A Backup.. He'll Let Me Know Soon :)
@  velma : (16 June 2013 - 12:05 AM) T_T It Seems That Someone Has Deleted That Topic Since I Found The Url Of The Topic But It Gives Me An Error
@  yordan : (15 June 2013 - 10:31 PM) @velma : It's A Tuto On How To Create A Login Program.
@  yordan : (15 June 2013 - 10:31 PM) Happy Birthday To Youuuuuu Agyat!
@  yordan : (15 June 2013 - 10:31 PM) Ba$
@  agyat : (15 June 2013 - 04:41 PM) :(
@  agyat : (15 June 2013 - 04:41 PM) Where The Hall I Were? 15Th Is Almost At End And No-One Wished Me "happy Birthday"!!!
@  velma : (14 June 2013 - 10:39 AM) Which Tutorial Is He Searching For?
@  velma : (14 June 2013 - 10:38 AM) Which Tutorial Is He Searching For?
@  yordan : (14 June 2013 - 07:47 AM) Ok, Have A Look Tomorrow.
@  yordan : (13 June 2013 - 03:19 PM) @velma, Can You Have A Look At Feelay's Problem? Seems That His Tutorial Is Not Searchable Today.
@  Feelay : (13 June 2013 - 08:11 AM) Oh, Haha
@  velma : (12 June 2013 - 05:39 PM) T_T Lately My Levels Of Procrastination..... **sigh**
@  velma : (12 June 2013 - 05:38 PM) I'll Do It Later
@  velma : (12 June 2013 - 05:38 PM) Procrastinators.. People Who Keep Saying "i'll Do This In A Bit"
@  Feelay : (12 June 2013 - 02:05 PM) Deal Punishments To What?

Photo
- - - - -

Help: SQL For Returning Data Between Dates


6 replies to this topic

#1 fabiocardoso

fabiocardoso

    Newbie [ Level 2 ]

  • Members
  • 25 posts

Posted 14 August 2005 - 10:10 AM

I have a data base that possesss a field BIRTH. How I make a research that returns me all the aniversariantes in definitive period? example: 01/02/2005 - 15/03/2005.

#2 WeaponX

WeaponX

    Way Out Of Control - You need a life :)

  • Members
  • 1,086 posts
  • Location:New York
  • myCENTs:86.41

Posted 14 August 2005 - 05:29 PM

I'm not very good at SQL but I think I found what you want. I remember reading about this when I was curious on how SQL works and found the a short tutorial at W3Schools.

#3 Houdini

Houdini

    Super Member

  • Members
  • 572 posts
  • Location:Nashville Tennessee

Posted 14 August 2005 - 06:05 PM

It would help if you at least showed us the database structure because fields are in tables and tables are in databases then you would know how to write a query to retrieve the table data (one particular field in this case) and after obtaining that data running a PHP script which would filter out the wanted or unwanted data here is and example of just a small table

CREATE TABLE `authors` (
  `aid` varchar(25) collate latin1_general_ci NOT NULL default '',
  `name` varchar(50) collate latin1_general_ci default NULL,
  `url` varchar(255) collate latin1_general_ci NOT NULL default '',
  `email` varchar(255) collate latin1_general_ci NOT NULL default '',
  `pwd` varchar(40) collate latin1_general_ci default NULL,
  `counter` int(11) NOT NULL default '0',
  `radminsuper` tinyint(1) NOT NULL default '1',
  `admlanguage` varchar(30) collate latin1_general_ci NOT NULL default '',
  PRIMARY KEY  (`aid`),
  KEY `aid` (`aid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

As you can see above all in single quotes are fields within a table called authors so from the limited information you gave it would be almost impossible to help someone answer your question. :D

#4 jvizueta

jvizueta

    Newbie [ Level 2 ]

  • Members
  • 22 posts

Posted 22 September 2005 - 11:44 PM

I have a data base that possesss a field BIRTH. How I make a research that returns me all the aniversariantes in definitive period? example: 01/02/2005 - 15/03/2005.

View Post


Try this:

Select * from orders Where orderdate >='19970805' and orderdate <
dateadd(dd,1,'19970805')

or this methods from sql:

DateTime
SamallDateTime

#5 Houdini

Houdini

    Super Member

  • Members
  • 572 posts
  • Location:Nashville Tennessee

Posted 15 October 2005 - 03:47 AM

Have you tried the below:
SELECT birth FROM "tablename" WHERE birth BETWEEN 2005/02/01 AND 2005/03/15

You will notice that I have rearranged the dates because MySQL expects the dates to be entered YYYY-MM-DD and from the post it look like you had expressed it as Feburary the first 2005 and March the 15th 2005.

So since that is how MySql stores dates as shown above then that would be how you have to query it to get the response you would want.

Also I used "tablename" since I have no clue as to what table the field birth would be in, but you should know what to substitute for it.

#6 Guest_FeedBacker_*

Guest_FeedBacker_*
  • Guests

Posted 29 May 2008 - 02:46 PM

sql queries for retriving dates between the given dates from the same table
Help: SQL For Returning Data Between Dates

Sql queries for retriving dates between the given dates from the same table
For example
05/13/2008 to 05/26/2008
I want to retrive the dates from a tables between those days...

-reply by sujai

#7 Guest_(G)vrutika shah_*

Guest_(G)vrutika shah_*
  • Guests

Posted 02 February 2009 - 06:28 AM

SELECT birth FROM "tablename" WHERE birth BETWEEN '2005/02/01' AND '2005/03/15'

-reply by vrutika shah





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users