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
:
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
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
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
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
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
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|
|
+--++---+---+---
-+---++
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
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
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
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 |
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
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
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,
, 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
, 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
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
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
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
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
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
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
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
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
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
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
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
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
28 matches
Mail list logo