About the system:
-The system has a total of 8 tables
- Users
- Tutor_Details (Tutors are a type of User,Tutor_Details table is linked to Users)
- learning_packs, (stores packs created by tutors)
- learning_packs_tag_relations, (holds tag relations meant for search)
- tutors_tag_relations and tags and
orders (containing purchase det...
Hi,
ever since I added this htaccess to my website, I noticed a HUGE slowdown, and my error logs are filled with errors such as
PHP Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in page.php on line 79
I've got up to four of these per second. Most of the time it works though.
The htaccess co...
I'm writing an application and I'm using MySQL as DBMS, we are downloading property offers and there were some performance issues. The old architecture looked like this:
A property is updated. If the number of affected rows is not 1, then the update is not considered successful, elseway the update query solves our problem.
If the update ...
Hi all,
I'm having some difficulties with a query:
SELECT d.*,
(SELECT COUNT(id) FROM downloads WHERE category = d.category) AS count
FROM downloads d
GROUP BY d.category
ORDER BY count DESC
So, I'm trying to get the total downloadcount of each category but this query hangs each time I run it.
The downloads table has +- 2...
I'm trying to import data from *txt to MySQL database with PHPMyAdmin. Using LOAD DATA INFILE.
Text file looks like:
Graph 1, order 7.
0000000
0000000
0000000
0000000
0000000
0000000
0000000
Graph 2, order 7.
0000001
0000000
0000000
0000000
0000000
0000000
1000000
Graph 3, order 7.
0000001
0000001
0000000
0000000
0000000
0000000
11000...
Hello,
I have a mysql table jobs.
This is the basic structure of jobs.
id
booked_user_id
assigned_user_id
I then also have another table, meta.
Meta has the structure:
id
user_id
first_name
last_name
Here is my php code
$sQuery = "
SELECT SQL_CALC_FOUND_ROWS job_id, job_name, priority_id, meta.first_name, date_booked
...
I have a .sql file generated by MysqlDump. How can i restore it via command prompt
...
Hi
I have a below SQL query
SELECT `User`.`username` , Permalink.perma_link_id, Permalink.locale,
Permalink.title, DATEDIFF( CURDATE( ) , Permalink.created ) AS dtdiff,
`TargetSegment`.segment_text, TargetSegment.source_segment_id,
TargetSegment.perma_link_id ,TargetSegment.created ,
TargetSegment.updated, DATEDIFF...
I have a VB.NET application and I need it to be able to display rows from a MySQL database. How would I do this?
Update: Another thing that I could do is have the app get a PHP page from the site that shows the DB, and gets the page every 10 seconds or so.
...
I have hierarchical data that I represent using the adjacency list model.
TABLE
ID
parentID
title
I am wondering, what is the simplest way to SELECT the number of immediate children for each node? If possible, I'd like to do this in a single select, yielding a resultset like so...
RESULTS...
ID title childCount
1...
Would this be better as a stored procedure or leave it as is?
INSERT INTO `user_permissions`
( `user_id`, `object_id`, `type`, `view`, `add`, `edit`, `delete`, `admin`, `updated_by_user_id` )
SELECT `user_id`, $object_id, '$type', 1, 1, 1, 1, 1, $user_id
FROM `user_permissions`
WHERE `object_id` = $object_id_2 AND `t...
I am no SQL expert, far from it. I am writing a Rails application, and I am new at that as well. I come from a desktop programming background.
My application has a table of data, one of the columns is the time at which the data was logged. I want to create a query with a 'safe window' around EACH row. By that I mean, it returns the ...
I'm not even sure if it's possible but I need it for my Access database. So I have following db structure :
Now I need to perform a query that takes category_id from my product and do the magic :
- let's say product belongs to console (category_id is in table Console)
- from console_types take type_id, where category_id == category_id...
I have 2 tables, one is an assets table which holds digital assets (e.g. article, images etc), the 2nd table is an asset_links table which maps 1-1 relationships between assets contained within the assets table.
Here are the table definitions:
CREATE TABLE `asset` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`source` varchar(255) DEFAUL...
Problem is as follows. I have a product that can be in one of three categories (defined by category_id). Each category table has category_id field related to category_id in product table. So I have 3 cases. I'm checking If my product.category_id is in table one. If yes, I take some values. If not I check in tables that are left. What can...
I would like to query my table for how many rows contain one or more instances of <CR><LF><LF>. I can't figure out the correct syntax. I would try LIKE '%<CR><LF><LF>%', but I don't know how to specify these special characters. I did try where mydata REGEXP '%[.CR.][.LF.][.LF.]%', and that didn't get a syntax error but neither did it ...
Hey all,
I need to query my database table to find which employee has the most support tickets related to them. I can do this just fine using this MySQL query:
SELECT employee_id, COUNT(id) AS number_of_tickets FROM tickets GROUP BY employee_id ORDER BY number_of_tickets DESC LIMIT 1;
How would write this in Ruby-on-Rails?
Thanks v...
Hi all,
Any idea on how to order the results of a MYSQL query by the sum of two columns rather than by a single column?
Select * FROM table ORDER BY (col1+col2) desc
I know that won't work., but I hope it conveys what I want to do fairly well.
Thanks!
...
Hi All,
I am using Kohana 3. I want to log the MySQL queries being executed by an application. The reason to determine the query of type INSERT,UPDATE and DELETE which are being executed in a process and store them in another MySQL table with date-time for further reference.
Can anybody tell how can I achieve this?
...
Hi
Is it possible to execute a query in regular interval?
ex: i want an mysql quuery to be executed every 20 minutes
...