Here is my query:
SELECT
DISTINCT `c`.`user_id`,
`c`.`created_at`,
`c`.`body`,
(SELECT COUNT(*) FROM profiles_comments c2 WHERE c2.user_id = c.user_id AND c2.profile_id = 1) AS `comments_count`,
`u`.`username`,
`u`.`avatar_path`
FROM `profiles_comments` AS `c` INNER JOIN `users` AS `u` ON u.id = c.user_id
WHERE (c.profile_id = 1) ORD...
Hi,
I have to repair broken nested set chains via script or sql. The table contains a left and a right value column, but no parent id column.
I am able to compute the level of each node within the nested set. There are gaps in left and right values. The structure of computed levels is valid.
Does someone know a solution to close the gaps...
I have a MySQL table looking like this. It's basically a time sheet for tasks.
id | task | user | start | stop | running
------+--------+--------+-----------------------+-----------------------+-----------
1 | 12 | 2 | 2009-10-01 10:05:00 | 2009-10-01 14:23:00 | 0
1 | 13 ...
I somehow need this feature,but MySQL doesn't support it at this moment.
I'm using GROUP_CONCAT(CONCAT(...)) to generate a xml-like stuff.
But when the size exceeds the limit,the xml is just broken!
So I have to somehow make it only retrieve 5 rows !
...
I have a MySQL database, containing a table with an auto_increment primary key.
Consider the following definition as sufficient for this example:
create table test(id integer not null auto_increment primary key) engine=innodb;
Now, typically I would insert into this table using the following syntax:
insert into test() values();
Th...
I have a database with a single table right now, which contains the following fields:
name, Suite
This is my first hacked together implementation of a database to track tests, and I realize that the way I am storing them is not efficient, but as I said, this is my first round of doing this.
Some of the names belong to suites, and so...
I was wondering how can you check to see if certain data is present in a database and if so display it on the web page and if not don't display it using PHP.
...
I am currently running mysqldump on a Mysql slave to backup our database. This has worked fine for backing up our data itself, but what I would like to supplement it with is the binary log position of the master that corresponds with the data generated by the mysqldump.
Doing this would allow us to restore our slave (or setup new slave...
I'm trying to see if the user has entered a website URL into the database with the following code. If the user did not enter their website's URL, do not display anything. If the user did enter their website, display the website.
I think I'm doing it wrong.
<?php
if (!empty($url))
{
echo'';
} else {
echo'p>Website: <a href="<?php...
I have a field, justsomenum, of type decimal(3,2) in MySQL that seems to always have values of 9.99 when I insert something like 78.3. Why?
This is what my table looks like:
mysql> describe testtable;
+---------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra ...
[Book] isbn(PK),title,category_id,subcategory_id,price
[Author] isbn(FK),author_id(PK),name
[Category] category_id(PK),name
[SubCategory] sub_category_id(PK),category_id(FK),name
I have a database (not designed by me) that contains the above four tables.
I want to have a book list having the following format:
isbn, title, author na...
I am trying to implement the pagination in php. I am using the Mysql as back end database. I am trying to implement the pagination logic.
I would be having lots of record. But the user will see only 10 at a time.
Now to show the first page, i do a
SELECT * from USERS LIMIT 10.
Now to get the next 10 and the subsequ...
Here is my existing query:
$Pareto = mysql_query("SELECT
zsca_open.tqs_batch_num AS 'Batch Number',
ft_tests.test_name AS 'Test Name',
(SUM(ft_stats.over_filter + ft_stats.under_filter)) AS 'Failures'
FROM
((zsca_open INNER JOIN ft_header ON zsca_open.tqs_batch_num = ft_header.batch_code)
INNER JOIN ft...
Hello
I want to sort data from mysql.
The shema looks like this:
id int(11)
objectId int(11)
type tinyint(4)
field tinyint(4)
value int(11)
date int(10)
id objectId type field value date
1 1631 0 10 2918 1183 746534
2 1631 0 11 1108 1183 746534
...
I'm a bit confused by the documentation here. I have a transaction, which
start transaction
does some updates
does some selects
does some more updates
commit
I want my selects at step 3 to see the results of updates in step 2 but I want to be able to roll back the whole thing.
read committed seems to imply that selects only show ...
any advise on backing up millions of data? or use tips in mySQL or software to the backing up job??
...
Hi,
I am working on fleet management. I want to create one table per vehicle ie when I create a vehicle I want a table to be created for that vehicle at run time. Now I am writing a procedure which creates table but table with same name is not created. How to achieve this?
Any alternative?
Technology: ASP.NET/MYSQL
What If I go for p...
Hello Experts,
I recieved a mysql backup without .dump as a extension from hosting provider. How do I restore that database somewhere else.
I am using linux box with mysql version 5.0 .
I have tried steps posted at http://stackoverflow.com/questions/105776/how-do-i-restore-a-mysql-dump-file but couldn't get through.
Thanks in advance...
I need a table variable to store the particular rows from the table within the MySQL procedure.
E.g. declare @tb table (id int,name varchar(200))
Is this possible? If yes how?
...
I need to create a menu with PHP from a MySQL database.
Table called categories has id, name, parent_id, shortdesc, etc.
The output need to have parent list and children list under the partent list as follows.
If you can show me codes or website, I will appreciate it.
<ul id="catmenu">
<li class="menulist">Cars
<ul>
...