Re: [PHP] SQL question

2010-01-27 Thread Skip Evans
Kim Madsen wrote: But Skip, as the others say, use a date class, since you're passing a php var on to the SQL anyway, then you could determine the exact days from start to end of donation. Combine this with to_days and you have your solution Yes, this sounds like the best way to go.

Re: [PHP] SQL question

2010-01-26 Thread tedd
At 9:54 PM -0600 1/25/10, Skip Evans wrote: Hey all, I have an SQL query that's stumping me. I have two date variables, $start and $end that are in mm/dd/ format and two database fields, start_date and no_donations. The start date is mm/dd/ format and no_donations is an integer that

Re: [PHP] SQL question

2010-01-26 Thread Kim Madsen
Michael A. Peters wrote on 26/01/2010 06:04: I use seconds from epoch in the database simply because it works so well with the php date() function. If you need something where Julian day really is better, I assume it isn't that hard to convert between posix and julian day, though it seems

Re: [PHP] SQL question

2010-01-25 Thread Paul M Foster
On Mon, Jan 25, 2010 at 09:54:40PM -0600, Skip Evans wrote: Hey all, I have an SQL query that's stumping me. I have two date variables, $start and $end that are in mm/dd/ format and two database fields, start_date and no_donations. The start date is mm/dd/ format and no_donations

Re: [PHP] SQL question

2010-01-25 Thread Michael A. Peters
Paul M Foster wrote: Typically, coders try to store dates in unix timestamps internally, and then add 86400 seconds for every day to calculate intervals and such. This is often inaccurate. Julian days are far more accurate.) Paul I use seconds from epoch in the database simply because it

Re: [PHP] SQL question

2010-01-25 Thread Michael A. Peters
Michael A. Peters wrote: If you need something where Julian day really is better, I assume it isn't that hard to convert between posix and julian day, though it seems odd to me that it isn't part of the date() function. It probably should be. Looks like unixtojd() and jdtounix() do it.

Re: [PHP] sql question

2005-04-07 Thread Joseph Connolly
if i understand you question... SELECT columns FROM table WHERE (condition #1) AND (condition #2); You can add many conditions. There are many ways to do this. This one is probably the most simple for only two conditions. Depending on your needs you also may need to create a subquery. SELECT

Re: [PHP] sql question

2005-04-07 Thread Philip Hallstrom
On Thu, 7 Apr 2005, William Stokes wrote: Hello, This is not a php but sql question. My apologies but I don't know any good sql forums and I know that someone here might be able to answer. OK so the question is. How to make a SELECT query with WHERE definition that requires 2 conditions to be

Re: [PHP] sql question

2005-04-07 Thread John Nichel
William Stokes wrote: Hello, This is not a php but sql question. My apologies but I don't know any good sql forums and I know that someone here might be able to answer. OK so the question is. How to make a SELECT query with WHERE definition that requires 2 conditions to be satisfied so that the

Re: [PHP] sql question

2003-06-04 Thread Marek Kilimajer
What about trying it first? Diana Castillo wrote: If I have a date in unix format in a numeric field in my table (Mysql) and I want to compare it to a date which is in unixformat also, will the query work like this? SELECT from tarifs where unix_from_date=.$dateinunixformat -- PHP General

Re: [PHP] SQL Question: Search Records between two dates.

2002-12-10 Thread Ernest E Vogelsinger
select * from table_name where (start_date ='2002-10-01' and start_date ='2002-12-10') or (end_date ='2002-10-01' and end_date ='2002-12-10') At 01:08 11.12.2002, [-^-!-%- said: [snip] Hello everyone, I need to get a recordset between two dates, and am

RE: [PHP] SQL Question

2002-03-28 Thread Rick Emery
How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For example say I wanted to list all my users alphabetically. How would I do this? You would sort in your SQL statement, not PHP. SELECT * FROM my table ORDER BY field_name; Or say I had a form and I wanted to present the

Re: [PHP] SQL Question

2002-03-28 Thread Jason Wong
On Thursday 28 March 2002 22:34, Sebastian A. wrote: How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For example say I wanted to list all my users alphabetically. How would I do this? Or say I had a form and I wanted to present the content to the user *AFTER* they have

RE: [PHP] SQL Question

2002-03-28 Thread Rick Emery
: Re: [PHP] SQL Question On Thursday 28 March 2002 22:34, Sebastian A. wrote: How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For example say I wanted to list all my users alphabetically. How would I do this? Or say I had a form and I wanted to present the content to the user

RE: [PHP] SQL Question

2002-03-28 Thread Marcus Rasmussen
] Subject: Re: [PHP] SQL Question On Thursday 28 March 2002 22:34, Sebastian A. wrote: How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For example say I wanted to list all my users alphabetically. How would I do this? Or say I had a form and I wanted to present the content

Re: [PHP] SQL Question

2002-03-28 Thread Jason Wong
On Friday 29 March 2002 00:30, Sebastian A. wrote: When you say ORDER BY that, is it also possible to do that via letters such as ORDER BY 'S', because from what I understand, ORDER BY has to be a column. In my example, 'this', 'that', 'the', 'other' are all columns. So yes, ORDER BY ,

RE: [PHP] SQL Question

2002-03-28 Thread Miguel Cruz
On Thu, 28 Mar 2002, Sebastian A. wrote: When you say ORDER BY that, is it also possible to do that via letters such as ORDER BY 'S', because from what I understand, ORDER BY has to be a column. The object of order by should be something that changes for each row, or else the statement is

RE: [PHP] sql question

2002-01-15 Thread Nathan Cassano
select * from tbl_lit where lit_source like 'c%'; Check out http://www.sqlcourse.com/ -Original Message- From: Wolf-Dietrich von Loeffelholz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 12:09 PM To: [EMAIL PROTECTED] Subject: [PHP] sql question i want that a select

RE: [PHP] sql question

2002-01-15 Thread Mehmet Kamil ERISEN
Hi do you care about case sensitivity? Nathan Cassano [EMAIL PROTECTED] wrote: select * from tbl_lit where lit_source like 'c%'; Check out http://www.sqlcourse.com/ -Original Message- From: Wolf-Dietrich von Loeffelholz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002

Re: [PHP] sql question

2002-01-15 Thread Janet Valade
select * from tbl_lit where lit_source like c% Janet - Original Message - From: Wolf-Dietrich von Loeffelholz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 12:09 PM Subject: [PHP] sql question i want that a select query display me all words beginning with an

RE: [PHP] sql question

2002-01-15 Thread Darren Gamble
Loeffelholz; [EMAIL PROTECTED] Subject: Re: [PHP] sql question select * from tbl_lit where lit_source like c% Janet - Original Message - From: Wolf-Dietrich von Loeffelholz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 12:09 PM Subject: [PHP] sql question i want

Re: [PHP] SQL question

2001-01-31 Thread Daniel Grace
"John LYC" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi all, does mysql support this? select * from tablename where id in (select id from table2 where cond) thanks No. MySQL does not support so-called sub-selects. Here's an easy workaround in PHP: