flyclassic Posted June 24, 2006 Share Posted June 24, 2006 Hi,i've a logic question anybody can help??if i've following mysql database(primary key id, `date_entry` datetime default NULL,)id | information | date_entry |01| handsome | 2006-06-24 18:06:19 |02| handsome1 | 2006-06-24 18:36:12 | 03| handsome 2 | 2006-06-23 19:06:13 |etc...I want to select * columns from date 2006-06-24 only regardless of time OR how do i select by a given date range, how do i go about doing that? any help will be greatly appreciated. THanks Quote Link to comment Share on other sites More sharing options...
hackerkts Posted June 24, 2006 Share Posted June 24, 2006 I"m not very sure about it, but you could create 1 more column and seperate date and time.It's easier to select using seperated date and time.[code]SELECT * FROM $table WHERE date ='2006-06-24'[/code]Where $table is the table.. Quote Link to comment Share on other sites More sharing options...
Barand Posted June 24, 2006 Share Posted June 24, 2006 [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]... [color=green]WHERE[/color] DATE_FORMAT(date, [color=red]'%Y[span style=\'color:orange\']-[/color]%m[color=orange]-[/color]%d'[/span]) [color=orange]=[/color] [color=red]'2006[span style=\'color:orange\']-[/color]06[color=orange]-[/color]24'[/span] [!--sql2--][/div][!--sql3--]or[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]... [color=green]WHERE[/color] date BETWEEN [color=red]'2006[span style=\'color:orange\']-[/color]06[color=orange]-[/color]24 00:00:00'[/span] [color=blue]AND[/color] [color=red]'2006[span style=\'color:orange\']-[/color]06[color=orange]-[/color]24 23:59:59'[/span] [!--sql2--][/div][!--sql3--] Quote Link to comment Share on other sites More sharing options...
flyclassic Posted June 25, 2006 Author Share Posted June 25, 2006 [!--quoteo(post=387580:date=Jun 24 2006, 05:45 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Jun 24 2006, 05:45 PM) [snapback]387580[/snapback][/div][div class=\'quotemain\'][!--quotec--][!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]... [color=green]WHERE[/color] DATE_FORMAT(date, [color=red]'%Y[span style=\'color:orange\']-[/color]%m[color=orange]-[/color]%d'[/span]) [color=orange]=[/color] [color=red]'2006[span style=\'color:orange\']-[/color]06[color=orange]-[/color]24'[/span] [!--sql2--][/div][!--sql3--]or[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]... [color=green]WHERE[/color] date BETWEEN [color=red]'2006[span style=\'color:orange\']-[/color]06[color=orange]-[/color]24 00:00:00'[/span] [color=blue]AND[/color] [color=red]'2006[span style=\'color:orange\']-[/color]06[color=orange]-[/color]24 23:59:59'[/span] [!--sql2--][/div][!--sql3--][/quote]PHEW!, this is cooly great help! THANK YOU GUYS! Quote Link to comment Share on other sites More sharing options...
.josh Posted June 25, 2006 Share Posted June 25, 2006 if you have a sql question, just cross your fingers and pray that barand will descend upon your thread. I swear he wrote the sql language [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] Quote Link to comment Share on other sites More sharing options...
Barand Posted June 25, 2006 Share Posted June 25, 2006 I wish I had, but that honour goes to Codd's team at IBM in 1979 and later taken up by the Oracle lot too. I've only been using it since about 1985, and the MySQL version for about 4 years. Quote Link to comment Share on other sites More sharing options...
flyclassic Posted June 25, 2006 Author Share Posted June 25, 2006 hahah, what's the debate all about?Who's genius? I think both are better than moi! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.