RE: [PHP-DB] Question on CURDATE()
** IMPORTANT NOTICE This communication is for the exclusive use of the intended recipient(s) named above. If you receive this communication in error, you should notify the sender by e-mail or by telephone (+44) 191 224 4461, delete it and destroy any copies of it. This communication may contain confidential information and material protected by copyright, design right or other intellectual property rights which are and shall remain the property of Piranha Studios Limited. Any form of distribution, copying or other unauthorised use of this communication or the information in it is strictly prohibited. Piranha Studios Limited asserts its rights in this communication and the information in it and reserves the right to take action against anyone who misuses it or the information in it. Piranha Studios Limited cannot accept any liability sustained as a result of software viruses and would recommend that you carry out your own virus checks before opening any attachment. <<<>>>I am using mysql Ver 12.22 Distrib 4.0.16 Sorry for not including that. Thanks -Rich -Original Message- From: Micah Stevens [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 13, 2005 9:13 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Question on CURDATE() What SQL server are you using? On Tuesday 13 September 2005 7:08 pm, reclmaples wrote: > I am trying to write a statement that will basically do this: > > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; > > But for some reason I can only use one CURDATE() reference in my sql > statement, does anyone know why? Is there a way I can get around this? > > > Any help would be greatly appreciated. > > Thanks > -Rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ** IMPORTANT NOTICE This communication is for the exclusive use of the intended recipient(s) named above. If you receive this communication in error, you should notify the sender by e-mail or by telephone (+44) 191 224 4461, delete it and destroy any copies of it. This communication may contain confidential information and material protected by copyright, design right or other intellectual property rights which are and shall remain the property of Piranha Studios Limited. Any form of distribution, copying or other unauthorised use of this communication or the information in it is strictly prohibited. Piranha Studios Limited asserts its rights in this communication and the information in it and reserves the right to take action against anyone who misuses it or the information in it. Piranha Studios Limited cannot accept any liability sustained as a result of software viruses and would recommend that you carry out your own virus checks before opening any attachment. <<<>>>AdmID:5DCB563F8D32B50D1F0808DDF15FF28D ** IMPORTANT NOTICE This communication is for the exclusive use of the intended recipient(s) named above. If you receive this communication in error, you should notify the sender by e-mail or by telephone (+44) 191 224 4461, delete it and destroy any copies of it. This communication may contain confidential information and material protected by copyright, design right or other intellectual property rights which are and shall remain the property of Piranha Studios Limited. Any form of distribution, copying or other unauthorised use of this communication or the information in it is strictly prohibited. Piranha Studios Limited asserts its rights in this communication and the information in it and reserves the right to take action against anyone who misuses it or the information in it. Piranha Studios Limited cannot accept any liability sustained as a result of software viruses and would recommend that you carry out your own virus checks before opening any attachment. <<<>>> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Question on CURDATE()
** IMPORTANT NOTICE This communication is for the exclusive use of the intended recipient(s) named above. If you receive this communication in error, you should notify the sender by e-mail or by telephone (+44) 191 224 4461, delete it and destroy any copies of it. This communication may contain confidential information and material protected by copyright, design right or other intellectual property rights which are and shall remain the property of Piranha Studios Limited. Any form of distribution, copying or other unauthorised use of this communication or the information in it is strictly prohibited. Piranha Studios Limited asserts its rights in this communication and the information in it and reserves the right to take action against anyone who misuses it or the information in it. Piranha Studios Limited cannot accept any liability sustained as a result of software viruses and would recommend that you carry out your own virus checks before opening any attachment. <<<>>>I am trying to write a statement that will basically do this: SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; But for some reason I can only use one CURDATE() reference in my sql statement, does anyone know why? Is there a way I can get around this? Any help would be greatly appreciated. Thanks -Rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ** IMPORTANT NOTICE This communication is for the exclusive use of the intended recipient(s) named above. If you receive this communication in error, you should notify the sender by e-mail or by telephone (+44) 191 224 4461, delete it and destroy any copies of it. This communication may contain confidential information and material protected by copyright, design right or other intellectual property rights which are and shall remain the property of Piranha Studios Limited. Any form of distribution, copying or other unauthorised use of this communication or the information in it is strictly prohibited. Piranha Studios Limited asserts its rights in this communication and the information in it and reserves the right to take action against anyone who misuses it or the information in it. Piranha Studios Limited cannot accept any liability sustained as a result of software viruses and would recommend that you carry out your own virus checks before opening any attachment. <<<>>>AdmID:EB9D127AD749FB030A007770AF02182A ** IMPORTANT NOTICE This communication is for the exclusive use of the intended recipient(s) named above. If you receive this communication in error, you should notify the sender by e-mail or by telephone (+44) 191 224 4461, delete it and destroy any copies of it. This communication may contain confidential information and material protected by copyright, design right or other intellectual property rights which are and shall remain the property of Piranha Studios Limited. Any form of distribution, copying or other unauthorised use of this communication or the information in it is strictly prohibited. Piranha Studios Limited asserts its rights in this communication and the information in it and reserves the right to take action against anyone who misuses it or the information in it. Piranha Studios Limited cannot accept any liability sustained as a result of software viruses and would recommend that you carry out your own virus checks before opening any attachment. <<<>>> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question on CURDATE()
Hi, I just noticed I was wrong, the original SQL statement would return rows, but only if BEGIN = CURDATE(). I stated it would never happen, and that's wrong. Sorry. :) -Micah On Tuesday 13 September 2005 9:42 pm, Micah Stevens wrote: > Hi Jordan, > > Syntactically, there is no restriction on OR'ing or AND'ing conditions. You > could very well do this: > > Select somefield where otherfield = 1 and otherfield = 2; > > Of course, otherfield would never be both 1 and 2, so this is a worthless > select statement, however, my point is, there would be no syntax error. > > Same deal with this: > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() AND END <= CURDATE(); > > This means, give me everything that begins before today or today, and after > today or today. Which of course is silly, that can't happen. So you'll > never get anything back. However, there's nothing syntactically wrong with > the statement. > > Replacing it by 'OR' give you all results, so it's just as silly why even > have the 'WHERE' condition in the first place? I think reclmaples needs to > re-analyze what he's trying to accomplish, but again, there's nothing > syntactically (stupid spellcheck) wrong with the statement. > > I'm going out on a limb here, but it seems what the point is to get > everythign that's not today, in which case you'd just say that: > > SELECT * FROM WEEKS WHERE BEGIN != CURDATE(); > > Or, if you only want today: > SELECT * FROM WEEKS WHERE BEGIN = CURDATE(); > > I hope that helps? not sure, I may as I said be missing the goal. > > -Micah > > On Tuesday 13 September 2005 9:14 pm, Jordan Miller wrote: > > Micah, > > Oh, my bad. I was trying to remember how I did something like this > > before, stringing together a lot of "WHERE"s. You're right, though, > > it wasn't "WHERE", it was "OR". > > > > Rich, > > I think you need "OR" instead of "AND", OR else I'm just totally out > > to lunch tonight: > > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() OR END <= CURDATE(); > > > > The syntax error is that something cannot be >= AND <= the same thing > > at the same time! > > > > I have had this problem before in the past. You say to yourself, > > well, I need all of the records, so that intuitively makes you choose > > "AND" when in SQL it should technically be "OR" (you want the > > records that are true for each of these operators separately, NOT at > > the same time, which for most records is impossible). > > > > Also, you may want to take away one of the "=" signs, or you may get > > something "=" to CURDATE() twice (not sure how SQL handles this). > > > > Maybe try (taking out one of the "="): > > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() OR END < CURDATE(); > > > > Maybe it's just late over here. Has anyone else run into this same > > thing? > > > > Jordan > > > > On Sep 13, 2005, at 10:36 PM, Micah Stevens wrote: > > > You can't do that in SQL, that would give you a big fat syntax error. > > > > > > On Tuesday 13 September 2005 7:45 pm, Jordan Miller wrote: > > >> Rich, > > >> > > >> Did you try putting "WHERE" twice? > > >> > > >> try: > > >> SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and WHERE END <= > > >> CURDATE; > > >> > > >> Jordan > > >> > > >> On Sep 13, 2005, at 9:08 PM, reclmaples wrote: > > >>> I am trying to write a statement that will basically do this: > > >>> > > >>> SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; > > >>> > > >>> But for some reason I can only use one CURDATE() reference in my sql > > >>> statement, does anyone know why? Is there a way I can get around > > >>> this? > > >>> > > >>> > > >>> Any help would be greatly appreciated. > > >>> > > >>> Thanks > > >>> -Rich > > >>> > > >>> -- > > >>> PHP Database Mailing List (http://www.php.net/) > > >>> To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question on CURDATE()
Hi Jordan, Syntactically, there is no restriction on OR'ing or AND'ing conditions. You could very well do this: Select somefield where otherfield = 1 and otherfield = 2; Of course, otherfield would never be both 1 and 2, so this is a worthless select statement, however, my point is, there would be no syntax error. Same deal with this: SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() AND END <= CURDATE(); This means, give me everything that begins before today or today, and after today or today. Which of course is silly, that can't happen. So you'll never get anything back. However, there's nothing syntactically wrong with the statement. Replacing it by 'OR' give you all results, so it's just as silly why even have the 'WHERE' condition in the first place? I think reclmaples needs to re-analyze what he's trying to accomplish, but again, there's nothing syntactically (stupid spellcheck) wrong with the statement. I'm going out on a limb here, but it seems what the point is to get everythign that's not today, in which case you'd just say that: SELECT * FROM WEEKS WHERE BEGIN != CURDATE(); Or, if you only want today: SELECT * FROM WEEKS WHERE BEGIN = CURDATE(); I hope that helps? not sure, I may as I said be missing the goal. -Micah On Tuesday 13 September 2005 9:14 pm, Jordan Miller wrote: > Micah, > Oh, my bad. I was trying to remember how I did something like this > before, stringing together a lot of "WHERE"s. You're right, though, > it wasn't "WHERE", it was "OR". > > Rich, > I think you need "OR" instead of "AND", OR else I'm just totally out > to lunch tonight: > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() OR END <= CURDATE(); > > The syntax error is that something cannot be >= AND <= the same thing > at the same time! > > I have had this problem before in the past. You say to yourself, > well, I need all of the records, so that intuitively makes you choose > "AND" when in SQL it should technically be "OR" (you want the > records that are true for each of these operators separately, NOT at > the same time, which for most records is impossible). > > Also, you may want to take away one of the "=" signs, or you may get > something "=" to CURDATE() twice (not sure how SQL handles this). > > Maybe try (taking out one of the "="): > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() OR END < CURDATE(); > > Maybe it's just late over here. Has anyone else run into this same > thing? > > Jordan > > On Sep 13, 2005, at 10:36 PM, Micah Stevens wrote: > > You can't do that in SQL, that would give you a big fat syntax error. > > > > On Tuesday 13 September 2005 7:45 pm, Jordan Miller wrote: > >> Rich, > >> > >> Did you try putting "WHERE" twice? > >> > >> try: > >> SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and WHERE END <= > >> CURDATE; > >> > >> Jordan > >> > >> On Sep 13, 2005, at 9:08 PM, reclmaples wrote: > >>> I am trying to write a statement that will basically do this: > >>> > >>> SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; > >>> > >>> But for some reason I can only use one CURDATE() reference in my sql > >>> statement, does anyone know why? Is there a way I can get around > >>> this? > >>> > >>> > >>> Any help would be greatly appreciated. > >>> > >>> Thanks > >>> -Rich > >>> > >>> -- > >>> PHP Database Mailing List (http://www.php.net/) > >>> To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question on CURDATE()
Micah, Oh, my bad. I was trying to remember how I did something like this before, stringing together a lot of "WHERE"s. You're right, though, it wasn't "WHERE", it was "OR". Rich, I think you need "OR" instead of "AND", OR else I'm just totally out to lunch tonight: SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() OR END <= CURDATE(); The syntax error is that something cannot be >= AND <= the same thing at the same time! I have had this problem before in the past. You say to yourself, well, I need all of the records, so that intuitively makes you choose "AND" when in SQL it should technically be "OR" (you want the records that are true for each of these operators separately, NOT at the same time, which for most records is impossible). Also, you may want to take away one of the "=" signs, or you may get something "=" to CURDATE() twice (not sure how SQL handles this). Maybe try (taking out one of the "="): SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() OR END < CURDATE(); Maybe it's just late over here. Has anyone else run into this same thing? Jordan On Sep 13, 2005, at 10:36 PM, Micah Stevens wrote: You can't do that in SQL, that would give you a big fat syntax error. On Tuesday 13 September 2005 7:45 pm, Jordan Miller wrote: Rich, Did you try putting "WHERE" twice? try: SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and WHERE END <= CURDATE; Jordan On Sep 13, 2005, at 9:08 PM, reclmaples wrote: I am trying to write a statement that will basically do this: SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; But for some reason I can only use one CURDATE() reference in my sql statement, does anyone know why? Is there a way I can get around this? Any help would be greatly appreciated. Thanks -Rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question on CURDATE()
You can't do that in SQL, that would give you a big fat syntax error. On Tuesday 13 September 2005 7:45 pm, Jordan Miller wrote: > Rich, > > Did you try putting "WHERE" twice? > > try: > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and WHERE END <= CURDATE; > > Jordan > > On Sep 13, 2005, at 9:08 PM, reclmaples wrote: > > I am trying to write a statement that will basically do this: > > > > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; > > > > But for some reason I can only use one CURDATE() reference in my sql > > statement, does anyone know why? Is there a way I can get around > > this? > > > > > > Any help would be greatly appreciated. > > > > Thanks > > -Rich > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question on CURDATE()
Rich, Did you try putting "WHERE" twice? try: SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and WHERE END <= CURDATE; Jordan On Sep 13, 2005, at 9:08 PM, reclmaples wrote: I am trying to write a statement that will basically do this: SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; But for some reason I can only use one CURDATE() reference in my sql statement, does anyone know why? Is there a way I can get around this? Any help would be greatly appreciated. Thanks -Rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question on CURDATE()
What's the exact error you're getting, I am able to do this: SELECT curdate( ) AS one, curdate( ) AS two; which results in this: one two 2005-09-13 2005-09-13 No error, there is no limit to the number of times you can issue a date call according to the MySQL documentation.. well, it doesn't directly say that, but it doesn't say there's a limit either. Are you sure it isn't a syntax error? The example you sent is missing parenthesis in the last curdate call. This should work: SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE(); Better, but I'm not sure if that's just a typo or not. -Micah On Tuesday 13 September 2005 7:20 pm, reclmaples wrote: > I am using mysql Ver 12.22 Distrib 4.0.16 > > Sorry for not including that. > > Thanks > -Rich > > -Original Message- > From: Micah Stevens [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 13, 2005 9:13 PM > To: php-db@lists.php.net > Subject: Re: [PHP-DB] Question on CURDATE() > > > > What SQL server are you using? > > On Tuesday 13 September 2005 7:08 pm, reclmaples wrote: > > I am trying to write a statement that will basically do this: > > > > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; > > > > But for some reason I can only use one CURDATE() reference in my sql > > statement, does anyone know why? Is there a way I can get around this? > > > > > > Any help would be greatly appreciated. > > > > Thanks > > -Rich > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Question on CURDATE()
I am using mysql Ver 12.22 Distrib 4.0.16 Sorry for not including that. Thanks -Rich -Original Message- From: Micah Stevens [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 13, 2005 9:13 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Question on CURDATE() What SQL server are you using? On Tuesday 13 September 2005 7:08 pm, reclmaples wrote: > I am trying to write a statement that will basically do this: > > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; > > But for some reason I can only use one CURDATE() reference in my sql > statement, does anyone know why? Is there a way I can get around this? > > > Any help would be greatly appreciated. > > Thanks > -Rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question on CURDATE()
What SQL server are you using? On Tuesday 13 September 2005 7:08 pm, reclmaples wrote: > I am trying to write a statement that will basically do this: > > SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; > > But for some reason I can only use one CURDATE() reference in my sql > statement, does anyone know why? Is there a way I can get around this? > > > Any help would be greatly appreciated. > > Thanks > -Rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Question on CURDATE()
I am trying to write a statement that will basically do this: SELECT * FROM WEEKS WHERE BEGIN >= CURDATE() and END <= CURDATE; But for some reason I can only use one CURDATE() reference in my sql statement, does anyone know why? Is there a way I can get around this? Any help would be greatly appreciated. Thanks -Rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php