For performance,I need to set a limit for the GROUP_CONCAT,
and I need to know if there are rows not included.
How to do it?
EDIT
Let me provide a contrived example:
create table t(qid integer unsigned,name varchar(30));
insert into t value(1,'test1');
insert into t value(1,'test2');
insert into t value(1,'test3');
select ...
I'm creating a table to hold items from rss feeds and I need to create a column 'description'. I selected the datatype as TEXT with no limit set with no index on this column. This is the error I'm getting:
#1071 - Specified key was too long; max key length is 1000 bytes
If I select to index this column, I get this error message:
#117...
Hi,
For this table:
mysql> select * from work;
+------+---------+-------+
| code | surname | name |
+------+---------+-------+
| 1 | John | Smith |
| 2 | John | Smith |
+------+---------+-------+
I'd like to get the pair of code where the names are equal, so I do this:
select distinct A.code, B.code from work A, work B ...
I'm looking for (free) online tutorials that teach the subjects as stated in the title, is there anyone who has any good ones to recommend?
Thanks!
...
How can I store the messages which I've written through javamail into MySql table? I already configured james server config file to connect to mysql server(with datasource element name maildb), and I changed the element in James server config file to
<inboxRepository>
<repository destinationURL="db://maildb/spammer/"
...
I have a mysql table where I have a column called 'timecreated' with a value of NOW() when it is inserted.
How can I write a MYSQL statement to get rows that were inserted from the past minute?
This is not working:
SELECT *
FROM mytable
WHERE timecreated > '(NOW() - 60)'
ORDER BY id DESC
LIMIT 0 , 30
...
Let's say I have a table with 3 columns: C1, C2, C3
I make a search based on the C1 column.
Could I make something similar like this (this is not working - because this is not the way prepareStatement it's used:) )
String c;// the name of the column
...
String sql = "select * from table where ? = ?";
pre = con.pre...
I'm getting an error when I'm trying to run this:
mysql> prepare stmt1 from "UPDATE test.users SET password = password('?') WHERE usrid = ?";
mysql> prepare stmt1 from "UPDATE test.users SET password = password(?) WHERE usrid = ?";
How can I make a prepared statement where a function takes my variable as an argument?
...
Hello
this SQL statement
"select firstname,lastname from users where lastname in('foo','bar') group by firstname"
it means select all records in table "users" where lastname match any of the "foo" or "bar"
I don't want this behaviour
what I want to retrieve is all records in "users" table where lastnames match all of "foo" and "b...
Yes, I know it's bad practice and I should instead normalize my tables. That put aside, is it possible to serialize a String [] array and store it in the database?
I am from the lenient and forgiving world of PHP, where invoking the serialize() function and would convert the array into a string.
Is there an equivalent of doing such her...
I had an inefficient piece of code for resetting passwords based on a user entering either their username or their email address. The PHP script branched depending on the identifier used. I collapsed it into one which now works if the user enters their username but not if they enter their email address. Here is the salient code:
$identi...
Hey,
I am building a mySQL table listing points in n-dimensions, each dimension being indexed. Given any point in the n-dimensional system, I would like to be able to output all of the other points in order of their distance from the chosen point.
A simple solution would be to calculate distances from each point using the pythagorean ...
Alright, which is faster and better to use?
Auto_increment
or
Call an sql which which does a max and then add one
So ultimately the question is should you use mysql to do it or do it yourself?
...
As you will see I am fetching the column, and trying to update column with new data.
$result2 line is my problem, I don't think I can add $row[0] in there. How do I do it?
$result = mysql_query("SELECT link FROM items LIMIT 3");
while($row = mysql_fetch_array($result))
{
$url=($row[0]);
$rez2 = get_final_url($url);
$result2...
setup:
mysql> create table bank(bank_id integer, bank_name varchar(255));
Query OK, 0 rows affected (0.27 sec)
mysql> create table accounts_bank(method tinyint, bank_id integer, amount float);
Query OK, 0 rows affected (0.09 sec)
mysql> insert into bank(bank_id, bank_name) values(1, 'A Bank');
Query OK, 1 row affected (0.05 sec)
mys...
Hi guys, I'm running a sql query to get basic details from a number of tables. Sorted by the last update date field. Its terribly tricky and I'm thinking if there is an alternate to using the UNION clause instead...I'm working in PHP MYSQL.
Actually I have a few tables containing news, articles, photos, events etc and need to collect al...
I am filtering null values, in php on MYSQL. When a null value is read, I need the MySQL to read the next record.
How do I go about doing that?
...
Hi, I imported some data into mysql database and trying to clean it up.
| ID | category name | parent name | parent_id
1 Baseball (this is a parent)
2 Ball | Baseball | null
3 Bat | Baseball | null
4 Glove | Baseball | null
5 Basketball (this is a parent)
6 Basket | Basketball | null
7 Net | Basketball | null
How do I do a UPDATE sta...
So, symbols belows display title should be displayed that way.
UTF-8 entities are listed below HTML (utf-8) title (here is list: LINK)
And last line shows what is stored in my database.
Collation of db table is utf8_unicode_ci.
I suppose that symbols in db shouldn't be as they are in my case?
They are displaying correctly on page when ...
Suppose I have this table:
ID | description
-------------------
5 | The bird flew over the tree.
2 | The birds, flew over the tree
These two rows have "similar" content. How would I remove #2?
What algorithm should I use for "similar" text?
How would I do this with Python?
Thanks!
...