ifang
-Original Message-
From: Keith Clark [mailto:keithcl...@k-wbookworm.com]
Sent: 13 May 2010 14:11
To: mysql@lists.mysql.com
Subject: Re: Count Query question
Bob,
Here are a few rows of my data:
17462, 0, '0929998596', '/GraphicNovels/0929998596.jpg', '8.5000
Bob,
Here are a few rows of my data:
17462, 0, '0929998596', '/GraphicNovels/0929998596.jpg', '8.5000',
'2010-05-12 19:02:47', '2008-10-01 00:00:00', '2008-10-01 00:00:00',
'0.50', 1, 1, 7429, 0, '1',
17461, 1, '1561481912', '/Cooking/1561481912.jpg', '3.', '2010-05-12
19:00:17', '2008-10-0
Kevin:
I assumed the following data:
products_id products_date_available products_quantity
11 2010-05-01 1
11 2010-05-02 0
11 2010-05-03 3
11 2010-05-04 3
11 2010-05-05 3
11 2010-05-06 1
11 2010-05-07 0
11 2010-05-08
Hi Bob,
No, actually it does not. I'm looking for the count of items. From
your query example I only get two rows. This table has over 2 1/2 years
of daily sales data.
Maybe I'm not stating my question correctly...h
Thanks for responding though, greatly appreciated.
Keith
On Wed, 20
Keith:
Does this work?
SELECT products_date_available, COUNT(products_quantity)
FROM products
WHERE products_quantity > 0
GROUP BY products_date_available
Hope this helps,
Bob
On May 12, 2010, at 3:06 PM, Keith Clark wrote:
> On Wed, 2010-05-12 at 10:13 -0400, Keith Clark wrot
On Wed, 2010-05-12 at 10:13 -0400, Keith Clark wrote:
> Chris,
>
> Here is my full table definition:
>
> CREATE TABLE `products` (
> `products_id` int(15) NOT NULL AUTO_INCREMENT,
> `products_quantity` int(4) NOT NULL,
> `products_model` varchar(15) NOT NULL DEFAULT '',
> `products_image` var
Chris,
Here is my full table definition:
CREATE TABLE `products` (
`products_id` int(15) NOT NULL AUTO_INCREMENT,
`products_quantity` int(4) NOT NULL,
`products_model` varchar(15) NOT NULL DEFAULT '',
`products_image` varchar(64) DEFAULT NULL,
`products_price` decimal(15,4) DEFAULT NULL,
`p
With out the table definitions, I'm not sure how anyone could help. Can
you send the output of "show create table" for each of the tables
involved in this query?
Chris W
Keith Clark wrote:
I'm trying to produce a report that will tell me how many products were
available with a Quantity>0 bef
Thanks!
2010/2/16 Peter Brawley
> David,
>
> >I need count the messages don'tread in a thread.
>
> Have a look at the edge list examples at
> http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html.
>
> PB
>
> -
>
> David Arroyo Menendez wrote:
>
> Hello,
>
> I've the next table s
David,
I need count the messages don'tread in a thread.
Have a look at the edge list examples at
http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html.
PB
-
David Arroyo Menendez wrote:
Hello,
I've the next table structure:
CREATE TABLE tx_cc20_mensajes (
uid int(11
Trees can be complex in SQL; these articles will give some different ideas to
handle it:
http://hashmysql.org/index.php?title=Trees_and_hierarchical_data_in_SQL
http://dev.mysql.com/tech-resources/articles/hierarchical-data.htm
Regards,
Gavin Towey
-Original Message-
From: David Arroyo M
essage-
> >From: Miguel Vaz [mailto:pagong...@gmail.com]
> >Sent: Wednesday, December 16, 2009 9:39 AM
> >To: Johan De Meersman
> >Cc: Gavin Towey; mysql@lists.mysql.com
> >Subject: Re: Count records in join
> >
> >Thanks all for the feedback. Here's what i
>-Original Message-
>From: Miguel Vaz [mailto:pagong...@gmail.com]
>Sent: Wednesday, December 16, 2009 9:39 AM
>To: Johan De Meersman
>Cc: Gavin Towey; mysql@lists.mysql.com
>Subject: Re: Count records in join
>
>Thanks all for the feedback. Here's what i d
Thanks all for the feedback. Here's what i did:
select p.id_prog,count(r.id_event) e from programas p left join(events r)
on(p.id_prog=r.id_prog) group by r.id_event
This gives me a list of all the distinct progs with a count of how many
events on each. I then delete the empty ones.
It would be
If the aim is purely to find the progs without events, it might be more
efficient to use something like
select * from progs where not exist (select id_prog from events where
id_prog = progs.id_prog);
My syntax might be off, check "not exists" documentation for more info.
On Tue, Dec 15, 2009 at
Hi Miguel,
You'll need to use LEFT JOIN, that will show all records that match and a row
in the second table will all values NULL where there is no match. Then you
find all those rows that have no match in your WHERE clause.
Regards,
Gavin Towey
-Original Message-
From: Miguel Vaz [ma
On 07/08/2009 06:11 PM, Gary Smith wrote:
Create a view or sub select, denormalizing the data and then group it.
select month, sum(login) as num_logins, sum(download) as num_downloads
from
(
select
monthname(s.created) as month_name
, if(ifnull(s.id, 0)> 0, 1, 0) as login
, if(ifnull(d.id, 0)>
listed first (I
could be wrong though -- chime in if you know the definitive answer please).
Anyway, try this and see if it gets you closer.
From: b [my...@logi.ca]
Sent: Wednesday, July 08, 2009 12:55 PM
To: mysql@lists.mysql.com
Subject: Re: COUNT from 2
On 07/08/2009 03:33 PM, Gary Smith wrote:
Off the top of my head, try this.
SELECT
MONTHNAME(s.created) AS month,
sum(if(ifnull(s.id,0)> 0, 1, 0)) AS num_logins,
sim(if(ifnull(d.id, 0)> 0, 1, 0)) AS num_downloads
FROM sessions AS s LEFT JOIN downloads AS d
ON d.session_id = s.id GROUP BY month
Off the top of my head, try this.
SELECT
MONTHNAME(s.created) AS month,
sum(if(ifnull(s.id,0) > 0, 1, 0)) AS num_logins,
sim(if(ifnull(d.id, 0)> 0, 1, 0)) AS num_downloads
FROM sessions AS s LEFT JOIN downloads AS d
ON d.session_id = s.id GROUP BY month
w in set (0.30 sec)
CheersFish
-Original Message-
>From: Roy Lyseng <[EMAIL PROTECTED]>
>Sent: Jul 31, 2008 9:41 AM
>To: Fish Kungfu <[EMAIL PROTECTED]>
>Subject: Re: COUNT returned rows of a SELECT
>
>Hi,
>
>generally you should be able to use the
On Thu, Jul 31, 2008 at 8:00 AM, Fish Kungfu <[EMAIL PROTECTED]> wrote:
> Ideally, I was hoping COUNT() could work like this, BUT it doesn't of
> course:
>
> mysql> SELECT COUNT(SELECT aviName,MAX(dateTime) ,count(*) FROM
> aviTrackerMain WHERE DATE(dateTime) LIKE CONCAT(DATE(NOW()),'%') GROUP
> BY
>-Original Message-
>From: Fish Kungfu [mailto:[EMAIL PROTECTED]
>Sent: Thursday, July 31, 2008 12:41 AM
>To: mysql@lists.mysql.com
>Subject: COUNT returned rows of a SELECT
>
>Using MySQL commands only (not PHP's mysql_num_rows), is there a way to
>COUNT the number of rows returned from a
Thanks for trying guys, but that's still not quite what I'm looking
for. All I really want is the total number of rows returned for the
query result.
For example, my the SELECT that Ananda suggested returns this:
mysql> SELECT aviName,MAX(dateTime) ,count(*) FROM aviTrackerMain WHERE
DATE(dateTi
On Wed, Jul 30, 2008 at 9:41 PM, Fish Kungfu <[EMAIL PROTECTED]> wrote:
> Using MySQL commands only (not PHP's mysql_num_rows), is there a way to
> COUNT the number of rows returned from a SELECT.GROUP BY?
>
> My primary SELECT query is this:
>
> SELECT aviName,MAX(dateTime) FROM aviTrackerMain
SELECT aviName,MAX(dateTime) ,count(*) FROM aviTrackerMain WHERE
DATE(dateTime)
LIKE CONCAT(DATE(NOW()),'%') GROUP BY aviName;
This will also give you count of rows
On 7/31/08, Fish Kungfu <[EMAIL PROTECTED]> wrote:
>
> Using MySQL commands only (not PHP's mysql_num_rows), is there a way to
>
On Fri, Jul 11, 2008 at 4:24 AM, Warren Windvogel
<[EMAIL PROTECTED]> wrote:
> $tables = mysql_list_tables($DB_DBName);
Not that it matters much, but mysql_list_tables() is deprecated.
--
Rob Wultsch
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
Radoulov, Dimitre wrote:
mysql -NBe'show databases' |
while IFS= read -r db; do
printf "show tables from %s;\n" "$db" |
mysql -N | while IFS= read -r t; do
printf "select count(1) from %s.%s;\n" "$db" "$t"
done
done | mysql -N |
awk '{ s += $1 }END{ print s }'
I quickly
Warren Windvogel wrote:
Hi,
Can anyone tell me how to check the total number of records in a
database in MySQL version 4.0
Googling doesn't seem to help and all previous posts assume version 5.*
[...]
Something like this:
mysql -NBe'show databases' |
while IFS= read -r db; do
printf
Warren Windvogel wrote:
> Hi,
>
> Can anyone tell me how to check the total number of records in a
> database in MySQL version 4.0
> Googling doesn't seem to help and all previous posts assume version 5.*
>
> Regards
> Warren
>
for table you can use:
SELECT COUNT(*) from the_table_name;
in whole da
Thanks to all.
> -Original Message-
> From: Michael Dykman [mailto:[EMAIL PROTECTED]
> Sent: September 28, 2007 1:36 PM
> To: Beauford
> Cc: mysql@lists.mysql.com
> Subject: Re: Count syntax
>
> 1 means that 1 will be added to the sum if the condition
>
attachments. Please notify the sender immediately by reply e-mail and delete
the e-mail from your system.
-Original Message-
From: Michael Dykman [mailto:[EMAIL PROTECTED]
Sent: Friday, September 28, 2007 1:36 PM
To: Beauford
Cc: mysql@lists.mysql.com
Subject: Re: Count syntax
1 means
1 and 0 do in this -
> SUM(IF(supportertype = 'L', 1, 0))
>
> > -Original Message-
> > From: Baron Schwartz [mailto:[EMAIL PROTECTED]
> > Sent: September 28, 2007 1:00 PM
> > To: Beauford
> > Cc: mysql@lists.mysql.com
> > Subject: Re
Thanks - it works, but what does the 1 and 0 do in this -
SUM(IF(supportertype = 'L', 1, 0))
> -Original Message-
> From: Baron Schwartz [mailto:[EMAIL PROTECTED]
> Sent: September 28, 2007 1:00 PM
> To: Beauford
> Cc: mysql@lists.mysql.com
> Subject: Re: Coun
Beauford wrote:
Hi,
I have the following line of code and I keep getting wrong results from it.
Can someone let me know what I'm doing wrong here. I just can't quite figure
out the syntax that I need.
select count(*) as numrows, count(supportertype) as leadcar from registrar
where supportertype
Servers24,
Hi Philip,
Thank you very much for your help.
Can you please tell me the differemce between COUNT(*) and COUNT(id) ?
Thanks again.
Actually sorry I was a bit misleading there. MySQL is optimized to
calculate...
SELECT COUNT(*) FROM aTable;
...but given the fact you've got a whe
>I can simply use this :
>SELECT id FROM sent WHERE member_id= ...
>and the use count($result) to count the number, but I want a faster
way, if
>possible.
SELECT COUNT(id) FROM sent WHERE member_id= ...
PB
Servers24 Network wrote:
Hi,
Well this question may seem funny, but I really need to
Servers24,
Well this question may seem funny...
No, a funny question would start something like "Why did the nun cross
the road?". ;^)
The problem is with counting a user's contribution in my site. Suppose
that
each user that send an email will be stored in DB. Now I want to count
number of
On Friday 29 December 2006 14:02, Servers24 Network wrote:
> Hi,
>
> Well this question may seem funny, but I really need to know!
> The problem is with counting a user's contribution in my site. Suppose that
> each user that send an email will be stored in DB. Now I want to count
> number of times
chris smith wrote:
> On 10/21/06, Dwight Tovey <[EMAIL PROTECTED]> wrote:
>> Hello all
>> Maybe it's been a long week, but I'm trying to do something that should
>> be
>> simple and just not getting anywhere.
>>
>> I have two tables:
>> accounts
>> acctid: int unique
>> acctowner: char
>> ..
On 10/21/06, Dwight Tovey <[EMAIL PROTECTED]> wrote:
Hello all
Maybe it's been a long week, but I'm trying to do something that should be
simple and just not getting anywhere.
I have two tables:
accounts
acctid: int unique
acctowner: char
...
docs
docid: int unique
acctid: int
docti
ch, 27. September 2006 15:48
An: André Hänsel; mysql@lists.mysql.com
Betreff: re: Count of children
André,
Your sentence 'I want the count of all sub-entries for a
specific entry' converts straight into SQL:
'I want'
SELECT
the count of all entries
COUNT(*) FROM myT
André,
I want the count of all sub-entries for a specific entry.
Depends on the model you are using--edge list or nested sets?
PB
-
André Hänsel wrote:
I have a table with id and parent_id.
I want the count of all sub-entries for a specific entry.
I found several documents about worki
-entries.
Example:
A
/ \
B C
/ \
D E
\
F
So I want to know that C has 3 sub-nodes.
> -Ursprüngliche Nachricht-
> Von: Rob Desbois [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 27. September 2006 15:48
> An: André Hänsel; mysql@lists.mysq
André,
Your sentence 'I want the count of all sub-entries for a specific entry'
converts straight into SQL:
'I want'
SELECT
the count of all entries
COUNT(*) FROM myTable
with a specific parent
WHERE parent_id = 5
You've missed one of the major benefits of SQL - it's designed to rea
You can use it:
SELECT parent_id, count( * )
FROM table
WHERE parent_id =1
GROUP BY parent_id
It´ll works fine.
""André Hänsel"" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
I have a table with id and parent_id.
I want the count of all sub-entries for a specific entry.
I
Hello,
@Mr. Price and Mr. Sims
Thank you for show me the way, your tips where very educational.
Thanks again.
--
Iván Alemán ~ [[ Debian (Sid) ]] ~
-BEGIN GEEK CODE BLOCK-
Version: 3.12
G!>GCM d+ s: a? C+++ UL++ P L+>+++$ E--- W++>+ N* o--- K- w O- M+ V--
PS++ PE-- Y PGP+>++ t-- 5 X R+
[...]
Is there any way to find out, using only plain SQL, the number of fields
of a given table.
describe gives me the number of fields as result, but I need to get only
that.
Is it possible?
Is it also possible to get only the fields name?
AFIK there's no easy way to accomplish this using j
David,
For the count of columns in a table:
SELECT count(information_schema.columns.column_name)
FROM information_schema.columns
WHERE information_schema.columns.table_schema = 'database_name'
ANDinformation_schema.columns.table_name = 'table_name'
For the names of the col
Hi David
If you are using mysql 5.0 and up, you can select from the
"INFORMATION_SCHEMA" database to get this information and much more.
Following is an example using a database called "test" and a table
called "t"
To get the column names, use
SELECT column_name FROM information_schema.co
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
v
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 fi
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 resu
- Original Message -
From: "Martin Gallagher" <[EMAIL PROTECTED]>
To:
Sent: Saturday, April 08, 2006 6:34 PM
Subject: COUNT() Efficiency
Hi,
If I did a query like:
SELECT COUNT(id) AS count1, COUNT(id) AS count2 FROM table WHERE id<100
Would MySQL run the COUNT() calculation once
Le mardi 24 janvier 2006 à 19:23 +0100, Fabien SK a écrit :
> Le mardi 24 janvier 2006 à 19:08 +0100, fabsk a écrit :
> > Thank you a lot for your answer. The bug is there: if I drop the index
> > 'tp_idx_part_solution', the result of the count is OK.
> > I recreated this index and the cound drop
Le mardi 24 janvier 2006 à 19:08 +0100, fabsk a écrit :
> Thank you a lot for your answer. The bug is there: if I drop the index
> 'tp_idx_part_solution', the result of the count is OK.
> I recreated this index and the cound drop to "2" again.
It doesn't happen on version 4.1.12-Max on my machine
Le mardi 24 janvier 2006 à 09:19 +0100, Martijn Tonies a écrit :
>> CREATE TABLE `tp_participation` (
>> `uid` int(11) NOT NULL default '0',
>> `challenge_id` int(11) NOT NULL default '0',
>> `response` text collate latin1_general_ci NOT NULL,
>> `points` int(11) default NULL,
>> UNIQUE K
> Thank you a lot for your answer. I checked very carefully. The structure
> of the table is (exported by phpMyAdmin):
>
> CREATE TABLE `tp_participation` (
> `uid` int(11) NOT NULL default '0',
> `challenge_id` int(11) NOT NULL default '0',
> `response` text collate latin1_general_ci NOT NU
that
> you aren't inadvertently writing the query incorrectly and that you really
> DO have 10 rows with cid = 123. If you still get 2 as the result of your
> query, I would recommend sending a bug report to MySQL.
>
> Rhino
>
> - Original Message -
> Fro
My guess would that your PHP code is not written correctly.
For instance, if you have a query in PHP:
$sql="select * from my_table where cid=123";
...and are using the PHP function mysql_numrows() to count the
results, and then for your next test... you're just changing the query
to:
$sql="sele
fabsk wrote:
> Hi,
>
> I'm facing a strange problem. I am using a database at my Internet
> provider (Free, France). The type of table is MyISAM (no choice), MySQL
> 4.1.15. I can do my tests with my PHP code or phpMyAdmin.
>
> The definition of my table is:
> - uid, int
> - cid, int
> - response,
o
- Original Message -
From: "fabsk" <[EMAIL PROTECTED]>
To:
Sent: Monday, January 23, 2006 5:32 PM
Subject: Re: count(*) send a wrong value
Thank you for you answer, but I read many times and I did not found
something to answer my question (well, I did not know about the NUL
Thank you for you answer, but I read many times and I did not found
something to answer my question (well, I did not know about the NULL).
In my case:
- there is one table
- htere is no "distinct"
- there is a WHERE clause, so there is no optimisation
- there is no other field and no "group by"
I
Thank you for you answer, but I read many times and I did not found
something to answer my question (well, I did not know about the NULL).
In my case:
- there is one table
- htere is no "distinct"
- there is a WHERE clause, so there is no optimisation
- there is no other field and no "group by"
I
>From the MySQL 4.1 manual
12.10.1. GROUP BY (Aggregate) Functions
COUNT(expr)
Returns a count of the number of non-NULL values in the rows
retrieved by a SELECT statement.
COUNT() returns 0 if there were no matching rows.
mysql> SELECT student.student_name,COUNT(*)
->FROM st
That's exactly what I'm looking for, thanks Eugene. :)
On Aug 5, 2005, at 12:46 AM, Eugene Kosov wrote:
Brian Dunning wrote:
I'm searching a table of people who own properties, and I want to
also include the total count of related properties, and the count
of related properties whose
Hello.
What do you think about this:
SELECT a.name,
COUNT(p.property_id) AS totalcount,
SUM( IF(p.status = 'Active' AND p.approval = 'Active',
1, 0)) AS CCOUNT
FROM accounts a, properties p
WHERE a.account_id =
Brian Dunning wrote:
I'm searching a table of people who own properties, and I want to also
include the total count of related properties, and the count of related
properties whose (status is 'Active' and approval is 'Active'). I've got:
select accounts.name, count(properties.property_id) a
stipe42 wrote:
I believe the difference is that count(*) includes nulls (because it is
counting the number of records), whereas count(column) only counts the
records where the column being counted is not null, regardless of the
total number of rows.
Right. COUNT(*) counts rows, COUNT(col) coun
I believe the difference is that count(*) includes nulls (because it is
counting the number of records), whereas count(column) only counts the
records where the column being counted is not null, regardless of the
total number of rows.
Hmm, on a related question then if I am correct above, does
cou
Hi,
What about SELECT count(*) FROM table1 - SELECT count(*) FROM table1
WHERE status = 1 ? (this query should be mush faster)
Regards,
Jocelyn
jpow wrote:
Hi everyone, I have this problem of slow "count *" when I use a where clause.
1. I have a table of ~1m rows.
2. There is a "status" c
select count(distinct ordr_ID) from store
-Original Message-
From: Gana [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 07, 2005 3:01 PM
To: mysql@lists.mysql.com
Subject: Count(*)
select count(*) from store group by orederId.
For the above sql, I am not getting the count of unique orde
[snip]
select count(*) from store group by orederId.
For the above sql, I am not getting the count of unique order ids..
[/snip]
select orderID, count(*) from store group by orderID
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysq
As you have already seen, it is pretty difficult trying to count things in
multiple columns. Although it is probably possible to do the counting, it
might require programming logic in order to count for specific values in the
various columns and then store the subtotals for each column so that they
Selon Micha Berdichevsky <[EMAIL PROTECTED]>:
> Hi.
> I have a table that store different items. For each items, I can attach
> up to 5 different textual categories.
> Those categories are free-text, and different columns can have the same
> values (example below).
> I am trying to select the coun
> >A subselect may help:
> >[...]
> >Don't know ATM if it can be done more easily, but a query like this
> >should probably work.
> >
> It can be done without a sub-query:
> [...]
>
> That *should* work, barring any typos or ommisions I may have made. I
> used LEFT JOIN because of personal prefere
Hi Shaun!
I beg you pardon, my last message was incomplete! I will quote the
last lines from my previous post:
---8<- Cut here ---8<---
>
> - Thanks to the LIMIT clause, we get only the first result, which by
> the way is one of the projects with the most assigned tasks.
Frederic Wenzel wrote:
On Sun, 17 Oct 2004 19:36:34 +, shaun thornburgh
<[EMAIL PROTECTED]> wrote:
A Project will have 1 or more tasks assigned to it. Using the following
query, how can I modify it so that I can find out the largest number of
tasks assigned to a group of projects.
SELECT P.*
Hi Shaun!
> A Project will have 1 or more tasks assigned to it. Using the
> following
> query, how can I modify it so that I can find out the largest
> number of
> tasks assigned to a group of projects.
>
> SELECT P.*, T.*
> FROM Projects P, Tasks T
> WHERE P.Project_ID = T.Project_ID
> AND P
On Sun, 17 Oct 2004 19:36:34 +, shaun thornburgh
<[EMAIL PROTECTED]> wrote:
> A Project will have 1 or more tasks assigned to it. Using the following
> query, how can I modify it so that I can find out the largest number of
> tasks assigned to a group of projects.
>
> SELECT P.*, T.*
> FROM Pr
Hi,
Tihs looks to me as too few information.
What is in your tables (the information)?
What does the query return (a empty set)? Maybe 'cause in your where clause
where you have Project_ID >2 you should have Project_ID=2? Or you have
several projects with ID>2 and you want tasks for all of
I think what you need is a pivot table (aka: cross tab report):
SELECT c.id
, c.campaign_name
, count(1) as total
, SUM(if(a.status='optin',1,0)) as optin
, SUM(if(a.status='optout',1,0)) as optout
FROM addresses as a
INNER JOIN addresses_incampaign as i
o
In the last episode (May 17), Gustavo Andrade said:
> select count(distinct membros.ID) as total_membros, count(distinct
> replays.ID) as total_replays, count(distinct downloads.ID) as
> total_downloads from membros,replays,downloads;
>
> if one of the tables have 0 records all the counts will tu
From: "Gustavo Andrade"
> select count(distinct membros.ID) as total_membros, count(distinct
> replays.ID) as total_replays, count(distinct downloads.ID) as
> total_downloads from membros,replays,downloads;
Why join three tables to count the records in each one? I'm sure the
performance will be po
Great! Thanks for the quick pointer!
ken
Quoting Diana Soares <[EMAIL PROTECTED]>:
> You may use MERGE TABLES:
>
> http://dev.mysql.com/doc/mysql/en/MERGE.html
>
> --
> Diana Soares
>
> On Tue, 2004-05-04 at 10:08, Ken Gieselman wrote:
> > Heya folks --
> >
> > Trying to come up with a way
You may use MERGE TABLES:
http://dev.mysql.com/doc/mysql/en/MERGE.html
--
Diana Soares
On Tue, 2004-05-04 at 10:08, Ken Gieselman wrote:
> Heya folks --
>
> Trying to come up with a way to count across multiple tables, and failing
> miserably. I need a simple way, preferably better than loope
Thanks a lot, Jigal and Egor - just what i searched for!
Sincerely
Victor
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Victor Sp?ng Arthursson <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> Is there a simple way to get the total number of rows a result _should_
> have had if no where-clause where present? Without doing a second
> query?
>
If you want to get total number of rows in the table (without WHERE and withou
From: "Victor Spång Arthursson" <[EMAIL PROTECTED]>
> Is there a simple way to get the total number of rows a result _should_
> have had if no where-clause where present? Without doing a second
> query?
Example from http://www.mysql.com/doc/en/Information_functions.html :
mysql> SELECT SQL_CALC_F
That works. I knew I was missing something simple. It was the GROUP BY
and the HAVING together.
Thank you very much.
>>> Michael Stassen <[EMAIL PROTECTED]> 2/25/2004 9:05:34 AM
>>>
Jacque Scott wrote:
> My program, NCR (Non-Conformity Report), keeps track of problems
with
> items that are r
Jacque Scott wrote:
My program, NCR (Non-Conformity Report), keeps track of problems with
items that are received from vendors. I am creating a report where the
user can retrieve a list of vendors that have had a NCR written against
them a certain number of times. For example, if the user wants
Whenever you use the Max() function on a column while accessing other
columns at the same time you need a GROUP BY statement so that the MAX()
function knows how to "group" it's results.
I suggest you look into the manual for this. In fact it has a tutorial
showing you options on how to do exactly
At 11:40 -0500 10/6/03, Steve Buehler wrote:
I am using PHP & MySQL for a program that I am writing. I have a
table in my database that has a column with dates in it in the form
-mm-dd. Sometimes there is nothing in the table with the search
date that I am using. Other times there might b
I think this is OK.
But if you want to get a recordset with data and know how much records you
have with only ONE query,
you may use:
$date=2003-02-16;
SELECT col1, col2, coln FROM `games` WHERE `date`='$date'
$num_rows=0;
$num_rows=mysql_num_rows($rs_resource_identifier);
I don't remember exact
On Wed, Jul 02, 2003 at 10:57:18AM -0500, Roy W wrote:
> Is there a simple MySQL command that will give a Row Count (# of records)
> WITHOUT running a select (huge database)
If it's a MyISAM table, just run a SELECT COUNT(*) FROM table_name.
It's really efficient. Try it. :-)
--
Jeremy D. Zawodn
If your table is MyISAM, then
SELECT COUNT(*) FROM tablename
Will return a rowcount without a major performance hit as the rowcount
is stored and a table scan is not needed.
Regards,
Mike Hillyer
www.vbmysql.com
> -Original Message-
> From: Roy W [mailto:[EMAIL PROTECTED]
> Sent: Wed
ph [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 10:33 AM
To: Mike Hillyer; [EMAIL PROTECTED]
Subject: RE: Count on Multiple Tables
CREATE TABLE `affiliate_clickthroughs` (
`affiliate_clickthrough_id` int(11) NOT NULL auto_increment,
`affiliate_id` int(11) NOT NULL default '0
ng_status` int(5) NOT NULL default '0',
`payment_date` datetime NOT NULL default '-00-00 00:00:00',
`commission_percent` decimal(4,2) NOT NULL default '0.00',
PRIMARY KEY (`affiliate_orders_id`)
) TYPE=MyISAM;
-Original Message-
From: Mike Hillyer [mailto:[EMAI
Can you show some table structure so we have something work with? It's
hard to recommend a query when we do not know what your sales table
structure is.
Regards,
Mike Hillyer
www.vbmysql.com
-Original Message-
From: Ralph [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 4:00 PM
At 16:42 -0500 3/12/03, Bob Sawyer wrote:
HELP! I'm getting the following error:
--
Error (SQL):
SELECT date, subject, location, private, id, duration, dategroup_id,
COUNT(DISTINCT subject) AS appointment_count, inituserid FROM mgw_calendar
WHERE userid=1 AND SUBSTRING(date,1,8) = '200
1 - 100 of 178 matches
Mail list logo