Hi,
I have a multi-column index (TrnsxType, TrnsxDate, TrnsxID, DepartID).
This index along with
a multi-column index of some child tables results in 8-column indexes
(TrnsxType, TrnsxDate, TrnsxID, DepartID, OrderType, OrderDate,
OrderNo, DepartmentID), etc.
I cannot eliminate Department ID
I have a query like:
SELECT a.a,aa,COUNT(b.id),COUNT(c.id) FROM a LEFT JOIN b ON (b.a_ref=a.id)
LEFT JOIN c ON (c.a_ref=a.id);
But it seems like SQL is mixing up the two count's. I get the count from table
c instead of table b for the first occurence of COUNT in the query.
Can I use two
Hi Jörn,
I don't think you can do it in one SELECT
as you'll get the same number (the max)
as soon as the COUNT goes above zero.
If you think about how your resultset looks
if you remove your COUNTs it becomes clearer.
Say that for one a.a you have 3 matches in b
and 2 matches in c, this will
You might try changing it to distinct if you are looking for unique count of
ids from each.
SELECT a.a,aa,COUNT(DISTINCT b.id),COUNT(DISTINCT c.id) FROM...
Since you are doing a left join, there always going to be something for b.id and c.id, even if the value is NULL. Distinct may
work to
On Monday 18 September 2006 14:55, Brent Baisley wrote:
You might try changing it to distinct if you are looking for unique count
of ids from each. SELECT a.a,aa,COUNT(DISTINCT b.id),COUNT(DISTINCT c.id)
FROM...
This return 0 or 1 for b.id (1 if there is 1 or more records) and the correct
Hi! Please post the actual SHOW CREATE TABLE statements for the tables
in question. Thanks!
Jay
On Mon, 2006-09-18 at 12:03 +0500, Asif Lodhi wrote:
Hi,
I have a multi-column index (TrnsxType, TrnsxDate, TrnsxID, DepartID).
This index along with
a multi-column index of some child tables
Hello,
My name is George and I'm from http://www.hikingforums.net/.
While visiting your site I have noticed that you are collaborated with other
sites, and I wish to invite you to work with my website as well.
If you can support Hiking Forums by adding a link to your site, I'll be happy
to
Hmmm, I have the urge to tell this guy to take hike...
- Original Message -
From: George McFee [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Saturday, September 16, 2006 10:00 AM
Subject: Link request from a Hiking Forums
Hello,
My name is George and I'm from
Hello list,
I have two tables:
Table A
a_id name
1a
2b
3c
Table B
b_id a_id flag name
12yx
22ny
33nz
How can I find the rows from table A where there is no matching row (joined
using a_id as key) in table B where flag is y?
So in this example I
Hi everyone
I didn't find any maillist regarding SQL question so I'm posting my question
in here.
I have a table like this
[ ID ][ Total ]
[ 1 ][ 20 ]
[ 2 ][ 30 ]
[ 3 ][ 40 ]
[ 4 ][ 10 ]
[ 5 ][ 20 ]
[ 6 ][ 20 ]
I want to run SQL query that will return to
-Ursprüngliche Nachricht-
Von: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 18. September 2006 23:28
An: mysql@lists.mysql.com
Betreff: SUM in WHERE
[...]
I want to run SQL query that will return to me the first
records that the
SUM of Total field = 100
Hi
I would expect the following result :
[ ID ][ Total ]
[ 1 ][ 20 ]
[ 2 ][ 30 ]
[ 3 ][ 40 ]
[ 4 ][ 10 ]
because if you SUM(Total) in the result you will see it = 100
On 9/19/06, André Hänsel [EMAIL PROTECTED] wrote:
-Ursprüngliche Nachricht-
Von: Ahmad
Ahmad Al-Twaijiry wrote:
Hi everyone
snip
SELECT * FROM tbl_name WHERE SUM(Total)=100 ORDER BY ID
SELECT ID FROM tbl_name GROUP BY ID HAVING SUM(Total)=100 ORDER BY ID
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
Hi all,
I'm fairly new to character sets and I'm trying to get a better
understanding of how mysql deals with them. I hope someone out there can
shed some light on a behavior that I am seeing. We're using mysql 4.1.12
with clustered tables.
I have a table with a varchar and a text field
14 matches
Mail list logo