Re: How to write this query?

2005-11-10 Thread SGreen
Michael McFadden <[EMAIL PROTECTED]> wrote on 11/10/2005 08:55:13 AM: > Hi Jerry. > > I'm new to the list, so don't take this as the final > answer. Wait for a guru to pounce with a better > solution! > > But, here is my idea: > > Before we start, note that "order" is a reserved word. > So we

Re: How to write this query?

2005-11-10 Thread Jerry Swanson
EMAIL PROTECTED] > Enviado el: Jueves, 10 de Noviembre de 2005 06:23 a.m. > Para: mysql@lists.mysql.com > Asunto: How to write this query? > > > How to write the query? > table1: order (order can have more than 1 item) > table2: item (has order_id). > table3: item_status (has it

RE: How to write this query?

2005-11-10 Thread ISC Edwin Cruz
aje original- De: Jerry Swanson [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 10 de Noviembre de 2005 06:23 a.m. Para: mysql@lists.mysql.com Asunto: How to write this query? How to write the query? table1: order (order can have more than 1 item) table2: item (has order_id). table3: item_status (ha

Re: How to write this query?

2005-11-10 Thread Michael McFadden
Hi Jerry. I'm new to the list, so don't take this as the final answer. Wait for a guru to pounce with a better solution! But, here is my idea: Before we start, note that "order" is a reserved word. So we must backtick `order` to reference the table in SQL (or the interpreter will think we're u

How to write this query?

2005-11-10 Thread Jerry Swanson
How to write the query? table1: order (order can have more than 1 item) table2: item (has order_id). table3: item_status (has item_status_id and item_id) table4: status (has item_status_id). Status can be 'complete', 'pending'. I need to get all orders that have ONLY completed items. Examples: if

RE: how to write this query?

2005-02-21 Thread Gordon
0/2000 | 2 | 01/10/2000 | +--++---+---+--- -+---++ 10 rows in set (0.00 sec) -Original Message- From: Mike Rains [mailto:[EMAIL PROTECTED] Sent: Monday, February 21, 2005 9:33 AM To: mysql@lists.mysql.com Subject: Re: how to write this query? SELECT start_date, end_date, DATEDIFF(end_date,

Re: how to write this query?

2005-02-21 Thread Mike Rains
SELECT start_date, end_date, DATEDIFF(end_date, start_date) - (WEEK(end_date) - WEEK(start_date)) * 2 AS business_days FROM DateDiffs ORDER BY start_date; +-+-+---+ | start_date | end_date| business

Re: how to write this query?

2005-02-21 Thread Jerry Swanson
It's not precisely correct. When time difference is less than 7, the time is calcualted wrong end_time 2005-01-10 17:53:33 end_time 2005-01-04 16:44:57 Result: days 6 Result: bussiness_days 6 On Sat, 19 Feb 2005 09:50:06 -0500, Mike Rains <[EMAIL PROTECTED]> wrote: > On Sat, 19 Feb 2005

Re: how to write this query?

2005-02-19 Thread Mike Rains
On Sat, 19 Feb 2005 14:01:05 +, Jerry Swanson <[EMAIL PROTECTED]> wrote: > I have two dates (start_date, end_date). Datediff() function returns > difference in days. > I need the difference but not including Satuday and Sunday. > > Any ideas? C:\Program Files\MySQL\MySQL Server 4.1\bin>mysql

how to write this query?

2005-02-19 Thread Jerry Swanson
I have two dates (start_date, end_date). Datediff() function returns difference in days. I need the difference but not including Satuday and Sunday. Any ideas? TH -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTE

Re: How to write this query

2003-10-03 Thread Bill Easton
s for B.*. Then, the second left join gives you C.* for that A_ID; it doesn't matter that the B.* part contains nulls. Bill > From: sean peters <[EMAIL PROTECTED]> > To: "Kevin Fries" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: Re: How to write th

Re: Updated: How to write this query

2003-10-01 Thread Michael Brunson
On Wed, 1 Oct 2003 16:58:26 -0500, sean peters <[EMAIL PROTECTED]> wrote: [...] | So ive been running a query like: | SELECT A_data, B_data, C_data FROM A, B, C | WHERE A.A_ID = B.A_ID | AND A.A_ID = C.A_ID | AND A.A_ID = 4; | [...] | | What i really want is to get the A_data from A, and if there

Updated: How to write this query

2003-10-01 Thread sean peters
Sorry, I had an error in my query. The fixed query with the entire post follows. Thanks for the responses to the incorrect one, im pretty sure that the suggestions will still fail for the previously indicated reasons, even with the modified query. ORIGINAL POST: (fixed) I've run into a situa

RE: How to write this query

2003-10-01 Thread Kevin Fries
ssage- > From: sean peters [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 01, 2003 2:23 PM > To: Kevin Fries; [EMAIL PROTECTED] > Subject: Re: How to write this query > > > Unfortunately that wont always work either. > > For instance, assume that there is an

Re: How to write this query

2003-10-01 Thread sean peters
; SELECT A_data, B_data, C_data > FROM A LEFT JOIN B ON A.A_ID = B.B_ID LEFT JOIN C ON A.A_ID = C.C_ID > WHERE A.A_ID = 4; > > > -Original Message- > > From: sean peters [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 01, 2003 12:07 PM > > To

RE: How to write this query

2003-10-01 Thread Kevin Fries
esday, October 01, 2003 12:07 PM > To: [EMAIL PROTECTED] > Subject: How to write this query > > > I've run into a situation where i dont know how to best write > a query. For a > base example, consider these 3 tables: > > CREATE TABLE A ( > A_ID

How to write this query

2003-10-01 Thread sean peters
I've run into a situation where i dont know how to best write a query. For a base example, consider these 3 tables: CREATE TABLE A ( A_IDINT NOT NULL PRIMARY KEY, A_data text ); CREATE TABLE B ( B_IDINT NOT NULL PRIMARY KEY, A_IDINT NOT NULL,

Re: How to write this query pls?

2003-05-27 Thread Peter Brawley
>Ways around inner select statments >Select ID, Sum(CASE WHEN phone.PHN = NULL THEN 1 ELSE 0 END) as PHNCount >from person left outer join phone on ID >where PHNCount = 0 GROUP BY phone.ID; The alias in the WHERE clause is illegal; it would have to be SELECT persons.ID, Sum( CASE WHE

Re: How to write this query??

2003-01-24 Thread Bill Easton
x27;2002-01-01' or heure1 >= '17:00:00') and (today < '2002-01-30' or heure1 <= '08:00:59'); > From: "Inandjo Taurel" <[EMAIL PROTECTED]> > Subject: How to write this query?? > Date: Thu, 23 Jan 2003 18:36:40 + > hi al

How to write this query??

2003-01-23 Thread Inandjo Taurel
hi all, i have a table trans with this structure: today(date) | heure1(time) | amount(double) | client(varchar 30) Now i need to write a query that would take the start date and time, end date and time, and return all the records between the two. So for example, the query should return all

How to write this query??

2003-01-23 Thread Inandjo Taurel
hi all, i have a table trans with this structure: today(date) | heure1(time) | amount(double) | client(varchar 30) Now i need to write a query that would take the start date and time, end date and time, and return all the records between the two. So for example, the query should return all

How to write this query??

2003-01-23 Thread Inandjo Taurel
hi all, i have a table trans with this structure: today(date) | heure1(time) | amount(double) | client(varchar 30) Now i need to write a query that would take the start date and time, end date and time, and return all the records between the two. So for example, the query should return all reco