This is the scenario:
I am developing a website which is similar to stackoverflow.com.
After an asker/seeker posts his question, other users can post their answers to the question.
A user can post more than one answer to the same question, but usually only the latest answer will be displayed. User can give comments on an answer, if comme...
Hello, I have several thousand MySQL users all set to allow access from a specific host. The problem is that now I'm going to have two machines (more in the future) which will need to use the same account to access each of their databases.
I'd like to a quick and easy (as automated as possible) way to run through and modify the host por...
How can I make a sql query like the following:
(SELECT `name` FROM table1)
UNION
(SELECT `name` FROM table2)
return each other. Ie. name1 from table1, name1 from table2, name2 from table1, name2 from table2 and so on?
Edit:
Table1
name
Hello
world
Table2
name
guten
tag
The output wanted:
Hello
guten
world
tag
and this should...
hi my friends
now i have table call files
its have time has this stamp 1260606325
now i tring to get the files which added in the last 7 day
SELECT * FROM `files` WHERE time > SUBDATE(NOW(),604800)
its return zero
how i can do that
...
I have a table with 50 columns and 1000s of rows. I want to output the top 5 records for each column. To get 1 record I do:
SELECT MAX(column1), MAX(column2), MAX(column3) FROM table
This gets the top value for each column but how can I get the second "max" value n times?
...
Hello All,
my CSV content looks like this
1234,123;123;123
5675,123;567;234;565
No Space is provided at the end of each row in CSV i.e. 1234,123;123;123(No space here)
Imported this using the following command
mysql> load data local infile 'E:\sample.csv' into table Test.Table1 fields
terminated by ',' lines terminated by '\n' (Co...
my problem is too complex
now i have files table
I selected from it the files which added in last seven days. it returns many ids like 1,2,3,4,5 ok
it's great. Now the problem:
i have tutorial table
every tutorial has some files of files table
now i selected from files which last added from 7 days
and make list ordered by files do...
I have a database with VARCHAR column url. I would like to fetch rows so that the ones that have any url value have priority over other rows, but are ordered by date row (descending), so ORDER BY 'url' DESC, 'date' DESC wouldn't work as it would order them alphabetically first. Basically, it would look something like this:
Table:
ID ...
I'm looking to implement fuzzy search for a small PHP/MySQL application. Specifically, I have a database with about 2400 records (records added at a rate of about 600 per year, so it's a small database). The three fields of interest are street address, last name and date. I want to be able to search by one of those fields, and essentiall...
I need to write an aggregate extension function (implemented in C) for mySQL 5.x. I have scoured the documentation (including browsing sql/udf_example.c) but I do not find anything that is brief, to the point and shows me just what I need to do.
This is the problem:
I have a C struct (Foo)
I have a C function that takes an array of t...
I have written a simple multi-threaded C program to access MySQL,it works fine except when
i add usleep() or sleep() function in each thread function.
i created two pthreads in the main method,
int main(){
mysql_library_init(0,NULL,NULL);
printf("Hello world!\n");
init_pool(&p,100);
pthread_t producer;
...
Hi,
I'm implementing the following access policy: a User can access a Resource if he created it, belongs to the Resource's group members or if the resource is publicly available.
Here is my DB structure (tables are MyISAM):
User (1K-10K Users)
id
nickame
…
index user_name(id, nickname)
Group (1K)
id
…
Resource (10K-100K)
...
Through many iterations of testing, I just noticed that my join table that represents a HABTM relationship between two models isn't removing entries when instances of these models get deleted. Do I need to do something special when removing an instance of a model that has HABTM relationships?
...
I want that a column of my database, composed by float random numbers, change every x seconds determined by a timer.
I read about Schedule Tasks Events but i can't work it.
Please help
...
Hi guys !
I am trying to put a symfony project on a client server for production.
The website worked fine on our company's server, but now i have this error :
500 | Internal Server Error | Doctrine_Connection_Exception
PDO Connection Error: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql...
Ok this one is realy tricky :D
i have a this table
bills_products:
- bill_id - product_id - action -
| 1 | 4 | add |
| 1 | 5 | add |
| 2 | 4 | remove |
| 2 | 1 | add |
| 3 | 4 | add |
as you can see product with the id 4 was added at bill 1 then re...
Hi all... I have 2 tables in my db...
Entita
id int(11)
descrizione varchar(50)
.....
Publicobjects
....
model varchar(50) the model I need (in this case 'Entita')
model_id int(11)
I would like to make a query like this:
select entita.*
from entita
where NOT EXISTS (select * from publicobjects where publicobjects.model = 'Entita' and ...
Hi All,
I am working on a web app that is hosted on a web server in a demilitarized zone (DMZ). I need to run MySQL queries on the database that is on its own server which is on the same local network as the web server, but not accessible via the internet.
I can access the Web Server using putty, and the web server has MySQL installed....
I'm trying to create a simple structure only dump of my database. Using mysqldump gives me a result like:
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!...
I have two mysql databases that have almost the same structure and representing the data of the same web app but one of them represents the current version and second one was made long time ago.
How can I create the database with both dumps inside but with old_ prefix for tables from the first and new_ prefix for tables from the second ...