Hi, how to query a list of records limiting the score, but including the
TOTAL of records satisfying the condition, all in one statement?
i.e.
SELECT title FROM news WHERE cond1 LIMIT 1, 10
plus
SELECT count(*) from NEWS WHERE cond1
all in one.
Thanks in advance
Nico
Hi,
the following query yields:
mysql> SELECT DISTINCT (@c:=@c+1), p.*,
count(k.keywords) AS found FROM keywords k, poll_keywords pk, poll p ,
section_poll sp WHERE 1 AND k.keywords IN ('quarto') AND
k.id_keyword=pk.id_keyword AND pk.id_poll=p.id_poll AND sp.id_section IN
(29, 0, 1, 2, 3, 4,
Hi, this is a follow-up to the previous message.
As far as I've understood when Innodb parses a Having clause it creates a
temporary table where it stores the results of the query satisfying all
the conditions except the HAVING clause, then it makes a
SELECT * from ... WHERE having_clause
on th
I had the same problems when executing queries with an HAVING clause and
TEXT fields SELECTed, at least using InnoDB tables.
If you are in the same position you can use substring(text_field, 128) to
solve your problem, at least partially.
Hope it helps
Nico
On Fri, 1
... you are really very kind and helpful!
Now I can avoid managing temp tables.
Thanks very much,
Nico Sabbi
-
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
Hi, I have the following tables :
CREATE TABLE articoli (
codice varchar(16) PRIMARY KEY,
descrizione varchar(255),
marca varchar(255) NOT NULL,
misure varchar(32),
pesofloa
without the index on keywords.codice:
mysql> show index from keywords;
+--++--+--+-+---+-+--++-+
| Table| Non_unique | Key_name | Seq_in_index | Column_name |
Collation | Cardinality | Sub_part |
HI,
I have two problems:
1)
I have the following table:
desc users;
+--+--+--+-+-+---+
| Field| Type | Null | Key | Default | Extra |
+--+--+--+-+-+---+
| username | varchar(128) | | PRI |
mysql> select (1 < 5 < 3);
+-+
| (1 < 5 < 3) |
+-+
| 1 |
+-+
1 row in set (0.00 sec)
mysql> select (1 < 5 and 5 < 3);
++
| (1 < 5 and 5 < 3) |
++
| 0 |
++
1 row in set (0.0