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

Re: How to write this query?

2005-11-10 Thread Michael McFadden
: 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

RE: How to write this query?

2005-11-10 Thread ISC Edwin Cruz
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 (has item_status_id

Re: How to write this query?

2005-11-10 Thread Jerry Swanson
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 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

Re: How to write this query?

2005-11-10 Thread SGreen
sure there is a better solution than using 'group_concat()' I'm here to learn too :) --- Jerry Swanson [EMAIL PROTECTED] wrote: 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

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-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|

RE: how to write this query?

2005-02-21 Thread Gordon
| +--++---+---+--- -+---++ 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, start_date) - (WEEK

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

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\binmysql -utest

how to write a query to return records has the closest date to end of month

2004-07-02 Thread [EMAIL PROTECTED]
Hi, guys I would like to write a query to return all records which has the closest date to the end of month. (Assume that date will be 6/30/2004) | id | product_id | price | snapshot_date | ++++---+ | 1 | 1 | 99.95 |2004-06-23 | | 2 |

How to write such query?

2004-01-25 Thread Mike Mapsnac
I want to get distinct title from table titles. But there are two differnt titles (new and used).So I need somehow join all three tables where user_tiles status='true' and titles are distinctive. Thanks titles

Re: How to write this query

2003-10-03 Thread Bill Easton
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 this query Date: Wed, 1 Oct 2003 16:22:46 -0500

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

2003-10-01 Thread Kevin Fries
, 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_IDINT NOT NULL PRIMARY KEY, A_data text ); CREATE TABLE B

Re: How to write this query

2003-10-01 Thread sean peters
, 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: [EMAIL PROTECTED] Subject: How to write this query I've run

RE: How to write this query

2003-10-01 Thread Kevin Fries
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 A record with A_ID = 4 And that there is a C record where A_ID = 4, but NO B

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

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

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 WHEN

RE: How to write delete query??

2003-02-17 Thread Joe Stump
to be happy. -Original Message- From: Inandjo Taurel [mailto:[EMAIL PROTECTED]] Sent: Monday, February 17, 2003 6:35 AM To: [EMAIL PROTECTED] Subject: How to write delete query?? SQL SQL hi all, i have a query that works just fine on Dbase, but just crashes on mysql. How can i write

RE: How to write delete query??

2003-02-17 Thread Inandjo Taurel
thanx joe, i checked. I just thought that there could be a way around this problem! From: Joe Stump [EMAIL PROTECTED] To: Inandjo Taurel [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: How to write delete query?? Date: Mon, 17 Feb 2003 09:46:53 -0800 MIME-Version: 1.0 Received: from

Re: How to write delete query??

2003-02-17 Thread Stefan Hinz
Inandjo, - delete from table1 where table1.field1 in (select distinct field2 from table2). Subselects (or nested queries) like that are supported as of MySQL 4.1. At this moment, you will have to compile 4.1 yourself; it's expected to be out as a binary version in the next couple of weeks. The

RE: How to write delete query??

2003-02-17 Thread Bill Kratochvil
17, 2003 8:35 AM To: [EMAIL PROTECTED] Subject: How to write delete query?? SQL SQL hi all, i have a query that works just fine on Dbase, but just crashes on mysql. How can i write it in one statement for it to work both on Dbase and mysql? the query: - delete from table1 where table1.field1

Re: How to write this query??

2003-01-24 Thread Bill Easton
Taurel [EMAIL PROTECTED] Subject: How to write this query?? Date: Thu, 23 Jan 2003 18:36:40 + 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

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