are attempting to enter transactions to wait until the select
query is finished.
The query is sizable so I have not included it here (I can if that would be
helpful.) Explain shows (abbreviated):
id select_typetabletypepossible keys
key_len
A SELECT will/can lock a table. It almost always does in MyISAM (no
insert/updates), almost never does in InnoDB. There is an exception to
every rule. The problem is most likely in the 107488 rows part of the
query. That's too many rows for InnoDB to keep a version history on so
it's likely just
On Tue, Mar 3, 2009 at 10:53 AM, Carl c...@etrak-plus.com wrote:
A query that is selecting data for a report locks the files that it accesses
forcing users who are attempting to enter transactions to wait until the
select query is finished.
Is it an INSERT INTO...SELECT FROM? Those lock
On Tue, Mar 3, 2009 at 12:35 PM, Brent Baisley brentt...@gmail.com wrote:
A SELECT will/can lock a table. It almost always does in MyISAM (no
insert/updates), almost never does in InnoDB. There is an exception to
every rule. The problem is most likely in the 107488 rows part of the
query
SELECT b.title, b.sub_title, b.descr, b.comment, b.bk_cover,
b.copyright, b.ISBN, c.publisher,
CONCAT_WS(' ', first_name, last_name) AS Author
FROM book AS b
LEFT JOIN book_author AS ab ON b.id = ab.bookID
LEFT JOIN author AS a ON ab.authID=a.id
LEFT JOIN book_publisher AS abc ON b.id
Hello,
On Thu, Feb 12, 2009 at 11:54 PM, Kiran Waje kiranw...@gmail.com wrote:
I have two Mysql servers and I want to Read data from one Mysql server to
another using stored procedure.
You may be able to use the Federated engine. Check the output of SHOW ENGINES.
--
Baron Schwartz,
I have two Mysql servers and I want to Read data from one Mysql server to
another using stored procedure.
))
) ENGINE=MyISAM;
I need to select all tga_body_blob.blob_data where tga_body.blob_id is
equal to tga_body_blob.blob_id and tga_body.file_id is equal to
'some_name' ordered by tga_body.blob_pos.
I can type in english what I want. However, I am stumped on the select
statement. I'm
`blob_data` (`blob_data`(64))
) ENGINE=MyISAM;
I need to select all tga_body_blob.blob_data where tga_body.blob_id is equal
to tga_body_blob.blob_id and tga_body.file_id is equal to 'some_name' ordered
by tga_body.blob_pos.
I can type in english what I want. However, I am stumped on the select
:30|
|yard|cat|109.83472, 22.45278, 43.29317|
2008-12-2601:14:30|
|yard|dog|110.05429, 22.43897, 43.31427|
2008-12-2601:14:57|
*
What I want to do is SELECT
What I want to do is SELECT only the most recent dateTime and critterXYZ for
each critterName and return one row for each unique critterName.
For examples discussion see Within-group aggregates at
http://localhost/artful/infotree/queries.php.
PB
-
Fish Kungfu wrote:
I have a dataset
Sorry LOL, make that http://www.artfulsoftware.com/infotree/queries.php.
PB
-
Peter Brawley wrote:
What I want to do is SELECT only the most recent dateTime and
critterXYZ for
each critterName and return one row for each unique critterName.
For examples discussion see Within-group
Thank you, Peter! I'll give that a try.
~~Fish~~
On Fri, Dec 26, 2008 at 2:33 PM, Peter Brawley
peter.braw...@earthlink.netwrote:
Sorry LOL, make that http://www.artfulsoftware.com/infotree/queries.php.
PB
-
Peter Brawley wrote:
What I want to do is SELECT only the most recent
Hi all,
I would like how to function select working internals. If each select
in BD is mono process or various select is processes in same time
without lock table?
Tks
Marcos
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http
Hi
how can i replace, in a SELECT query, the last 3 numbers with asterisks?
from 0123456789 to 0123456***
--
Scripts: http://www.spacemarc.it
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Hi
how can i replace, in a SELECT query, the last 3 numbers with
asterisks?
from 0123456789 to 0123456***
My psudocode for this would be something like:
Select
CONCAT(left$(`field`,(LENGTH(a)-3),'***')
From `table`
But there might be more efficient ideas out
-Original Message-
From: spacemarc [mailto:[EMAIL PROTECTED]
Sent: Friday, December 05, 2008 8:50 AM
To: MySQL
Subject: SELECT with replacement chars
Hi
how can i replace, in a SELECT query, the last 3 numbers with asterisks?
from 0123456789 to 0123456***
[JS]
SELECT CONCAT(LEFT
thanks, it works fine (on mysql 4 and 5)
SELECT CONCAT(LEFT(myfield,LENGTH(myfield) - 3), '***') FROM table;
--
Scripts: http://www.spacemarc.it
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Hi, I have tried to use this query: SELECT count(smsc_id) as total,
insertdate FROM momtbak WHERE insertdate BETWEEN
DATE_SUB(CURRENT_DATE(), INTERVAL 4 WEEK) AND CURRENT_DATE() group by
week(date_format(insertdate,'%Y-%m-%d'),3) to group records in the
last 4 weeks by week. But the result
Hi,
I finally found the solution
SELECT count( smsc_id ) AS total, week( insertdate ) AS tanggal
FROM momtbak
WHERE insertdate
BETWEEN DATE_SUB( CURRENT_DATE( ) , INTERVAL 4 WEEK )
AND CURRENT_DATE( )
GROUP BY week( insertdate )
Willy
--
MySQL General Mailing List
For list archives: http
Hi,
I get stuck to build a query to select records between curdate() and the
last 4 weeks and groupped by week. I tested with:
SELECT *
FROM momtbak
WHERE insertdate
BETWEEN curdate( )
AND curdate( ) - INTERVAL 4 week
It doesn't work. Please help, TIA.
Willy
Every why hath a wherefore
On Thu, 2008-12-04 at 08:27 +0700, sangprabv wrote:
Hi,
I get stuck to build a query to select records between curdate() and the
last 4 weeks and groupped by week. I tested with:
SELECT *
FROM momtbak
WHERE insertdate
BETWEEN curdate( )
AND curdate( ) - INTERVAL 4 week
It doesn't
: sangprabv [EMAIL PROTECTED]
Subject: Re: Query to Select records in the last 4 weeks
Date: Wed, 03 Dec 2008 17:52:32 -0800
SELECT * FROM momtbak
WHERE insertdate
BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 4 WEEK) AND CURRENT_DATE();
--
MySQL General Mailing List
For list archives: http
] wrote:
Hi list.We have 2 tables, both have a few inserts, many updates and the
occasional select.
When running a select joining the 2 tables (which can take upto 20 seconds
to complete, they are large tables) all updates are blocked and the
maxconnections is quickly reached.
We tried
STATUS, which will give complete activity on innodb
engine, including lock information.
Please show use the output of these.
regards
anandkl
On 11/27/08, David Scott [EMAIL PROTECTED] wrote:
Hi list.We have 2 tables, both have a few inserts, many updates and the
occasional select.
When
Hi David,
can you please let me know what is the select query and the update query
along with the explain plan of the same.
can you please let me know if you are using innodb storage engine?
Regards,
Chandru
www.mafiree.com
On Thu, Nov 27, 2008 at 4:45 PM, David Scott
[EMAIL PROTECTED]wrote
Hi list.We have 2 tables, both have a few inserts, many updates and the
occasional select.
When running a select joining the 2 tables (which can take upto 20 seconds
to complete, they are large tables) all updates are blocked and the
maxconnections is quickly reached.
We tried copying the data
, sorry, here it is:
SELECT gS.gameid, g.gamename, COUNT(DISTINCT(gS.sessionid)) 'sessions',
SUM(gSL.endTime - gSL.startTime)/COUNT(DISTINCT(gS.sessionid))/60 'average
SESSION time',
SUM(gSL.totalTime)/COUNT(DISTINCT(gS.sessionid))/60 'average PLAY time',
SUM(gSL.totalTime)/60
FROM
Hi,
I am pretty new in optimizing tables with index and may need some help.
This is my query:
EXPLAIN SELECT timestamp
FROM Meting_INT_COPY
WHERE blockid = '200811252000'
ORDER BY timestamp DESC
LIMIT 1
If I have an index(blockid),
EXPLAIN will return the following information:
type
Hello,
Let's suppose I have 5 database: db1, db2, db3, db4, and db5. They all
have the same structure but different data.
I would like perform this select
SELECT TaskDoneOn, TaskDoneBy
FROM {database}
WHERE TaskDoneOn IS NOT NULL
and collect the data from all 5 database. However, I would
structure but different data.
I would like perform this select
SELECT TaskDoneOn, TaskDoneBy
FROM {database}
WHERE TaskDoneOn IS NOT NULL
and collect the data from all 5 database. However, I would like to
avoid doing something like this:
SELECT TaskDoneOn, TaskDoneBy
FROM db1
WHERE TaskDoneOn
On Fri, Nov 21, 2008 at 12:44 PM, Andre Matos [EMAIL PROTECTED] wrote:
Hello,
Let's suppose I have 5 database: db1, db2, db3, db4, and db5. They all have
the same structure but different data.
I would like perform this select
SELECT TaskDoneOn, TaskDoneBy
FROM {database}
WHERE TaskDoneOn
I was trying to avoid both since the SELECT statement is not fixed.
Time to time, users want different information.
Thanks,
Andre
On 21-Nov-08, at 12:59 PM, Peter Brawley wrote:
Andre Matos wrote:
Today I have 5, but tomorrow I can have 50 and I don't want to
forget any database.
Do
Sounds interesting, but does the MERGER support complex SELECT
statements and LEFT JOIN?
Andre
On 21-Nov-08, at 1:45 PM, Brent Baisley wrote:
On Fri, Nov 21, 2008 at 12:44 PM, Andre Matos [EMAIL PROTECTED]
wrote:
Hello,
Let's suppose I have 5 database: db1, db2, db3, db4, and db5
, Nov 21, 2008 at 2:12 PM, Andre Matos [EMAIL PROTECTED] wrote:
Sounds interesting, but does the MERGER support complex SELECT statements
and LEFT JOIN?
Andre
On 21-Nov-08, at 1:45 PM, Brent Baisley wrote:
On Fri, Nov 21, 2008 at 12:44 PM, Andre Matos [EMAIL PROTECTED]
wrote:
Hello
Many MySQL APIs (such as PHP) allow you to treat the result returned from a
SHOW statement as you would a result set from a SELECT; see Chapter 22, APIs
and Libraries, or your API documentation for more information. In addition,
you can work in SQL with results from queries on tables
to treat the result
returned from a
SHOW statement as you would a result set from a SELECT; see Chapter
22, APIs
and Libraries, or your API documentation for more information. In
addition,
you can work in SQL with results from queries on tables in the
INFORMATION_SCHEMA database, which you
:
Many MySQL APIs (such as PHP) allow you to treat the result returned from
a
SHOW statement as you would a result set from a SELECT; see Chapter 22,
APIs
and Libraries, or your API documentation for more information. In
addition,
you can work in SQL with results from queries on tables
in the list. I am not
allowed to. That's why I was thinking to use only a SELECT statement to do
the job as I have been doing.
Thanks,
Andre
On 21-Nov-08, at 3:16 PM, Olexandr Melnyk wrote:
Hello Andre,
I would recommend you to rethink your criteria (if there's any) for
splitting
the only
way to proceed,
remaining on mysql environment, is to use metadata, that is
information_schema.
for instance the following statement gives you all the tables in your
mysql instance:
mysql select TABLE_SCHEMA,TABLE_NAME from information_schema.TABLES
where TABLE_NAME='your_table
as suggested here in the list. I
am not allowed to. That's why I was thinking to use only a SELECT
statement to do the job as I have been doing.
Thanks,
Andre
On 21-Nov-08, at 3:16 PM, Olexandr Melnyk wrote:
Hello Andre,
I would recommend you to rethink your criteria (if there's any
:21:39 -0500
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: SELECT through many databases
CC: mysql@lists.mysql.com
A MERGE table is just a virtual table that is made up of other tables.
You treat it no differently than any other table, pretend it's a real
table.
You could
hi all...
i have a strange problem with a simple script that is doing select into
outfile...
the thing just does that. it does a select into an outfile. if i print
the query that's passed to mysql_result in the script and then copy it
and paste it z`into the mysql client it works fine
Maybe you can use mysql -e instead.
On Mon, Oct 20, 2008 at 12:51 AM, walter harms [EMAIL PROTECTED] wrote:
hi ronaldo i tried and failed.
it seems that mysql has no option to specify a select statement.
did i mis something ?
re,
wh
walter harms schrieb:
hi ronaldo,
iadmit i
select * from
(
SELECT ID_number, count( CU_number ) AS CC
FROM MyTable
GROUP BY ID_number
) T
WHERE CC =
(
select max(cc) from
(
SELECT ID_number, count( CU_number ) AS CC
FROM MyTable
GROUP BY ID_number
) T2
)
On Wed, Oct 15, 2008 at 5:08 PM, dave aptiva [EMAIL PROTECTED]wrote:
Hello all
-
From: walter harms [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2008 5:06 AM
To: 'mysql'
Subject: select ... into outfile=stdout ?
hi list,
i need some options from outfile (exspecialy:FIELDS TERMINATED BY) and would
like
to send the output to stdout to further processing
hi ronaldo i tried and failed.
it seems that mysql has no option to specify a select statement.
did i mis something ?
re,
wh
walter harms schrieb:
hi ronaldo,
iadmit i was mysql (the command) fixated :)
thx a lot,
wh
Rolando Edwards schrieb:
Try mysqldump !!!
On this web page
Hello all,
I'm new to sql and have a question if someone would be kind enough to help
me with, if I have a table that stores telemarketers by ID_number and the
customer that they spoke to by CU_number and I use a select statement such
as;
SELECT ID_number, count( CU_number )
FROM MyTable
2008/10/17 dave aptiva [EMAIL PROTECTED]:
I tried SELECT ID_number, max( count( CU_number ) ) but this causes an error
# - Invalid use of group function
# sqlite3
SQLite version 3.5.9
Enter .help for instructions
sqlite create table moo (id_number, cu_number);
sqlite insert into moo(1, 1
Hello all,
I'm new to sql and have a question if someone would be kind enough to help
me with, if I have a table that stores telemarketers by ID_number and the
customer that they spoke to by CU_number and I use a select statement such
as;
SELECT ID_number, count( CU_number )
FROM MyTable
SELECT ID_number, count( CU_number )
FROM MyTable
GROUP BY ID_number
order by 2 desc
limit 10
will give you the top 10. Change 10 to whatever you want or take off the
limit clause to get all records.
On Fri, Oct 17, 2008 at 4:25 AM, dave aptiva [EMAIL PROTECTED]wrote:
Hello all,
I'm new
hi list,
i need some options from outfile (exspecialy:FIELDS TERMINATED BY) and would
like
to send the output to stdout to further processing.
unfortunately i found no proper way to force the output to stdout. for now i use
the redirection of the mysql -NB output but the interface lacks the
meaning as the
corresponding clauses for LOAD DATA INFILE. See Section 12.2.6, LOAD DATA
INFILE Syntax.
By default, its output to stdout.
Give it a try !!!
-Original Message-
From: walter harms [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2008 5:06 AM
To: 'mysql'
Subject: select
Hi!
Andrew == Andrew Aksyonoff [EMAIL PROTECTED] writes:
Andrew Hello Sergey,
Andrew Monday, September 15, 2008, 10:41:31 PM, you wrote:
in MySQL but in general case it can't assume any order and will have
to re-sort the sub-select result by outer GROUP BY instead of inner
ORDER
Hello Michael,
Tuesday, September 30, 2008, 8:00:36 PM, you wrote:
Andrew However if the specific sorting algorithm is not stable it *might*
MW It's not stable; MySQL is using several different technics to
MW calculate GROUP BY and may thus return the rows in any order within
MW the group by.
Hi,
-
(SELECT id FROM domains where name='abc.com');
gives a result of 124
i am also able to use and get proper results for the following query:
select * from domains where id=(SELECT id FROM domains where name='abc.com
what is the issue ur facing.
Any syntax error or something else.
trying usin IN instead of =
On 9/26/08, Madan Thapa [EMAIL PROTECTED] wrote:
Hi,
-
(SELECT id FROM domains where name='abc.com');
gives a result of 124
i am also able
--
---
(SELECT id FROM domains where name='abc.com');
gives a result of 124
i am also able to use and get proper results for the following query:
select * from domains where id=(SELECT id FROM domains where name='abc.com
Hi,
ok i got it working. it was a typo(lol), i missed from in the initial select
statment
Wrong
###
select * db_users where db_id=(SELECT id FROM data_bases where
dom_id=(SELECT id FROM domains where name='abc.com'));
Correct
##
select * from db_users where db_id=(SELECT
Hello,
On Sep/24/2008, Phil wrote:
Just a wild guess but, did you perhaps change the filesystem to a
journalling filsystem when moving to the different server?
mount reports the same (ext3)
I once accidently moved my database from an ext2 to an ext3 partition and it
took me a while to
does it have the same network speed as your old server.
On 9/25/08, Carles Pina i Estany [EMAIL PROTECTED] wrote:
Hello,
On Sep/24/2008, Phil wrote:
Just a wild guess but, did you perhaps change the filesystem to a
journalling filsystem when moving to the different server?
mount
is /tmpdir parameter on both machines using the default value
On 9/25/08, Carles Pina i Estany [EMAIL PROTECTED] wrote:
Hello,
On Sep/25/2008, Ananda Kumar wrote:
does it have the same network speed as your old server.
yes, it has. But I'm running the query from localhost :-) (socket
Hello,
On Sep/25/2008, Ananda Kumar wrote:
is /tmpdir parameter on both machines using the default value
Old machine: yes.
New machine: I have tried two places (different partitions, same FS
-ext3-, same hard disk). On the old machine it's in a different
partition of the same hard disk than
Hello,
On Sep/25/2008, Ananda Kumar wrote:
does it have the same network speed as your old server.
yes, it has. But I'm running the query from localhost :-) (socket
connection). Even, the query only returns one number and I don't have
any federated tables, etc.
On 9/25/08, Carles Pina i
On the new machine its on a different partition than the database.
Also did u try to analyze the table and run the query
On 9/25/08, Carles Pina i Estany [EMAIL PROTECTED] wrote:
Hello,
On Sep/25/2008, Ananda Kumar wrote:
is /tmpdir parameter on both machines using the default value
Hello,
On Sep/25/2008, Ananda Kumar wrote:
On the new machine its on a different partition than the database.
Also did u try to analyze the table and run the query
I will do it (maybe on Saturday, as I guess that will take long time to
do it). But I think that I did last weekend when I
hardware are quite similar, and servers
software installation are similar too (Debian, ext3).
Mysql version:
mysql select version();
+--+
| version()|
+--+
| 5.0.32-Debian_7etch6-log |
+--+
1 row in set (0.00 sec
seconds the query that I will show to
2 min. 50 seconds). Servers hardware are quite similar, and servers
software installation are similar too (Debian, ext3).
Mysql version:
mysql select version();
+--+
| version()|
+--+
| 5.0.32
Hello,
I need help with a SQL Select statement:
I have three tables: report, category, and optional
a) report table has 3 fields:
ReportId, CategoryId, ReportDesc
b) category table has 2 fields:
CategoryId, CategoryDesc
c) optional table has three fields:
OptionalId, CategoryId
look at using the group_concat function on OptionalDesc and group by the
other fields.
On Mon, Sep 22, 2008 at 1:40 PM, Andre Matos [EMAIL PROTECTED]wrote:
Hello,
I need help with a SQL Select statement:
I have three tables: report, category, and optional
a) report table has 3 fields
Select statement:
I have three tables: report, category, and optional
a) report table has 3 fields:
ReportId, CategoryId, ReportDesc
b) category table has 2 fields:
CategoryId, CategoryDesc
c) optional table has three fields:
OptionalId, CategoryId, OptionalDesc
I would like to have something
Well, for your simple example, you can use query variables to add the
counters.
SET @cntr:=0, @lastVal:='A'
INSERT INTO tableB LOC,DATA SELECT CONCAT(LOC,
CONCAT( IF(@lastVal=LOC, @cntr:[EMAIL PROTECTED], @cntr:=0),
IF(@lastVal:=LOC,'',''))) LOC, CONCAT(DATA, @cntr) FROM tableA ORDER
:='A'
INSERT INTO tableB LOC,DATA SELECT CONCAT(LOC,
CONCAT( IF(@lastVal=LOC, @cntr:[EMAIL PROTECTED], @cntr:=0),
IF(@lastVal:=LOC,'',''))) LOC, CONCAT(DATA, @cntr) FROM tableA ORDER
BY LOC
That should add a sequential number to LOC and DATA that will reset
to 0 whenever the value of LOC
I have an existing data set - here is an example (the real one is more
complex than this)
LOC DATA
-
A 1
B 2
C 3
D 4
E 5
F 6
...
and I am looking to run some sort of INSERT ... SELECT on this to make
a new table like this:
LOC
SELECT this, that, theOther,
SUM(IF(SUBSTRING(myDate,1,10) = '20080101' AND SUBSTRING(myDate,1,10)
= '20080131'), 1, 0) AS `January`
FROM theTable
GROUP BY theOther
Throws this error...
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL
Try this:
SELECT this, that, theOther,
SUM(IF(SUBSTRING(myDate,1,10) = '20080101' AND SUBSTRING(myDate,1,10)
= '20080131', 1, 0)) AS `January`
FROM theTable
GROUP BY theOther
Problem was in parentheses
Dusan
Jay Blanchard napsal(a):
SELECT this, that, theOther,
SUM(IF(SUBSTRING(myDate,1,10
Hi,
OS - Solaris 10, 32 Gb RAM, mysql 64-bit 4.1.22
Every day I see in processlist many SELECT queries that stay in NULL state for a
long time. Something Like this
| 368966 | radius | fire-u1:35671 | srg_conf | Query | 106 | NULL
|SELECT id, deleted_id, status, name
64-bit 4.1.22
Every day I see in processlist many SELECT queries that stay in NULL state
for a long time. Something Like this
| 368966 | radius | fire-u1:35671 | srg_conf | Query | 106 |
NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 )
FROM s
| 368967
If you want MYSQL to process the SELECT, including information about how tables
are joined and in which order
usehttp://dev.mysql.com/doc/refman/5.0/en/using-explain.htmle.g. EXPLAIN
[EXTENDED] SELECT select_optionsIf you want MySQL uses the stored key
distribution to decide the order
,
PRIMARY KEY (`id`),
KEY `root_id` (`root_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
AUTO_INCREMENT=21 ;
I can select all trees and order them by the date-field of their root.
SELECT n.*,
count(*)+(n.lft1) AS level
FROM posts n, posts p
WHERE n.lft BETWEEN p.lft AND p.rgt
This one time, at band camp, Perrin Harkins [EMAIL PROTECTED] wrote:
In your case, you might be able to just cheat it with some
MySQL-specific LIMIT stuff:
Thanks very much Perrin, this is most useful and I can take it from
here.
Kind regards
Kevin
--
MySQL General Mailing List
For list
I have 3 tables (schema below) with categories, questions and answers.
Each category can of course have many questions in it. Also, the
answers are multiple choice, so each question can have several
related answers. I am trying to achieve 2 goals.
1) SELECT N questions and the related answers
1) SELECT N questions and the related answers from each category.
See Within-group quotas (Top N per group) at
http://www.artfulsoftware.com/infotree/queries.php.
PB
Kevin Waterson wrote:
I have 3 tables (schema below) with categories, questions and answers.
Each category can of course
This one time, at band camp, Peter Brawley [EMAIL PROTECTED] wrote:
See Within-group quotas (Top N per group) at
http://www.artfulsoftware.com/infotree/queries.php.
Yes, I have seen that, very clever. How does it relate to my situation?
Simply point to vague references is not helpful.
Kevin
How does it relate to my situation?
Simply point to vague references is not helpful.
Vague? Not in the slightest. General? Indeed, by design.
You'd written Any help in this matter hugely appreciated. If that's
not so, please feel free entirely ignore my suggestion.
PB
-
Kevin Waterson
This one time, at band camp, Peter Brawley [EMAIL PROTECTED] wrote:
Vague? Not in the slightest. General? Indeed, by design.
I have read this before..
It uses a single table, I am using multiple tables. I am not selecting
the TOP 10 or whatever. This example has no relationships where the
It uses a single table, I am using multiple tables. I am not selecting
the TOP 10 or whatever. This example has no relationships where the
schema I presented does.
Eh? We can treat any query as one derived table; it makes no difference
to the principle involved. And the same within-aggregate
trying to achieve 2 goals.
1) SELECT N questions and the related answers from each category.
The result needs to have say, 5 questions from each category.
Of course, the answers for each of the questions needs to be there also.
2) SELECT N questions and related answers from specified
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 WHERE
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
-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 SELECT
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 aviName
Beautiful! That's exactly what I needed. Thanks, Roy
mysql SELECT COUNT(*) FROM (SELECT aviName,MAX(dateTime) FROM aviTrackerMain
WHERE DATE(dateTime) LIKE CONCAT(DATE(NOW()),'%') GROUP BY aviName) as T;
+--+
| COUNT(*) |
+--+
| 49 |
+--+
1 row in set (0.30 sec
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 WHERE DATE(dateTime)
LIKE CONCAT(DATE(NOW()),'%') GROUP BY aviName
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
I may be approaching this all wrong, but I need to know a percentage of
total sales within a select statement.
So I can do something like this:
Select company, state, sales, sum(sales) / sales as percent
From Sales
Thanks,
David Ruggles
CCNA MCSE (NT) CNA A+
Network EngineerSafe Data
yes, u can use the below sql.
regards
anandkl
On 7/25/08, David Ruggles [EMAIL PROTECTED] wrote:
I may be approaching this all wrong, but I need to know a percentage of
total sales within a select statement.
So I can do something like this:
Select company, state, sales, sum(sales) / sales
: Ananda Kumar [mailto:[EMAIL PROTECTED]
Sent: Friday, July 25, 2008 10:37 AM
To: David Ruggles
Cc: mysql
Subject: Re: How do I (can I) use aggregate functions inside a select
yes, u can use the below sql.
regards
anandkl
On 7/25/08, David Ruggles [EMAIL PROTECTED] wrote:
I may be approaching
David Ruggles wrote:
I may be approaching this all wrong, but I need to know a percentage of
total sales within a select statement.
So I can do something like this:
Select company, state, sales, sum(sales) / sales as percent
From Sales
mmh, you want
sum(sales where company=foo
Hi David,
Try
Select company, state, sales, sum(sales) / sales as percent
From Sales GROUP BY company, state;
Not sure if you always want to group by state; if each company exists in
only one state then the group by is irrelevant, if not then it will give
you the by-state breakdown.
On Fri
401 - 500 of 4787 matches
Mail list logo