I have a 3 tables that I'm trying to join and get distinct results.
CREATE TABLE `car` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB
mysql> select * from car;
+----+-------+
| id | name |
+----+-------+
| 1 | acura |
+----+-------+
CREATE TABL...
The script I'm using is
if($profile['username'] == $user['username']) {
$db->query("UPDATE users SET newcomments = 0 WHERE username = '$user[username]'");
echo "This is a test";
}
(Note that $db->query is exactly the same as mysql_query)
For some very odd reason, the MySQL query is being performed even if the defined conditio...
I have a backup created of my mysql database (vbulletin forum v3.8) everyday. It's about 360mb in size. It's stored as one text file in a secure folder.
I'm thinking of getting another server, through a different host, and somehow automatically transferring the backup to my second server every day.
Any ideas on how I could automate th...
This is for a new feature on http://cssfingerprint.com (see /about for general info).
The feature looks up the sites you've visited in a database of site demographics, and tries to guess what your demographic stats are based on that.
All my demgraphics are in 0..1 probability format, not ratios or absolute numbers or the like.
Essenti...
We are developing an application with Visual Studio 2008 and TFS. Our database is a MySQL DB. As we develop we keep the new queries that need to be applied to the database of our new release as the New Version Update Queries. Right now I'm keeping them in a simple text file (which is a painful task!). I know that TFS integrates with MSSQ...
I have a table of data that is searchable and sortable, but likely to produce hundreds or thousands of results for broad searches. Assuming the user searches for "foo" and sorts the foos in descending price order I'd like to show a quick-jump select menu like so:
<option value="1">Page 1 ($25,000,000 - $1,625,000)</option>
<option value...
Hi, basically, I have 3 tables; users and projects, then I have 'users_projects' to allow the one-to-many formation. When a user adds a project, I need the project information stored and then the 'userid' and 'projectid' stored in the usersprojects table. It sounds like its really straight forward but I'm having problems with the syntax...
Hi,
I'm trying to make a dump of a MySQL table on the server and I'm trying to do this in Zend. I have a model/mapper/dbtable structure for all my connections to my tables and I'm adding the following code to the mappers:
public function dumpTable()
{
$db = $this->getDbTable()->getAdapter();
$name = $this->getDbTable()->info('na...
Hi all.
I need to use something to coordinate my system with several consumers/producers each running on different machines with different operating systems. I have been researching on using MySql to do this, but it seems ridiculously difficult.
My requirements are simple: I want to be able to add or remove consumers/producers at any ti...
I'm creating a database with what I anticipate will be a long (perhaps several paragraphs for some tuples) attribute. I'm assigning it text instead of varchar. I have two questions:
Should I give a maximum value for the text field? Is this necessary? Is it useful?
Since the contents of this field will be displayed on a website in H...
Sorry if this is too simple, but thanks in advance for helping. This is for MySQL but might be relevant for other RDMBSs
tblA has 4 columns: colA, colB, colC, mydata, A_id
It has about 10^9 records, with 10^3 distinct values for colA, colB, colC.
tblB has 3 columns: colA, colB, B_id
It has about 10^4 records.
I want all the records fr...
Hi all.
I'm trying to compile Q4M (http://q4m.31tools.com) for MySql 5.1.44 since there is not a precompiled package available for this release.
The installation instructions seem straightforward (http://q4m.31tools.com/install.php) but I did have to put the files in others dirs than mentioned - maybe because I'm using Ubuntu.
Here's ...
I have a mysql table for votes. there's an id, a project_id and a vote field (which is 1 if a specific project is voted). now i want to generate a ranking from those entries. is there a way to get the number of votes for each project_id and automatically sort the entries by the number of TRUE votes of a project with a single mysql query?...
Hi, I have those two tables:
client:
id (int) #PK
name (varchar)
client_category:
id (int) #PK
client_id (int)
category (int)
Let's say I have those datas:
client: {(1, "JP"), (2, "Simon")}
client_category: {(1, 1, 1), (2, 1, 2), (3, 1, 3), (4,2,2)}
tl;dr client #1 has category 1, 2, 3 and client #2 has only category 2
...
What is the best way to databind parent/child relations? Lets say I have two simple objects:
Parent with the following properties, ParentId, Name and Childs and
Child with the following properties, ChildId, Name and Parent.
I want to write a repository using MySql for this but is failing when I bind both Childs and Parent properties, ...
This one seems to be a simple problem, but I can't make it work in a single
select or nested select. Retrieve the authors and (if any) advisers of a
paper (article) into one row.
I order to explain the problem, here are the two data tables (pseudo)
papers (id, title, c_year)
persons (id, firstname, lastname)
plus a link table w/one e...
the table videos has the folowing feels
id,average,name
how can i write the query, to select the name of video, which have the max average!!!
i can do that vith two queries, by selecting the max(avege) from the table, and then find out the name, where ihe average equal to max!!! but i want to do that in one query!!!
help me please!!!
...
I am a little new to store procedures in MySQL and was wondering if I can SELECT multiple columns into multiple variables within the same select query.
for example (iName is the input to the function):
DECLARE iId INT(20);
DECLARE dCreate DATETIME;
SELECT Id INTO iId, dateCreated INTO dCreate FROM products WHERE pName=iName;
Thank...
As most of you know, Sun acquired MySQL (and later Oracle acquired Sun), and during these acquisitions, there were a lot of FUD in MySQL community which resulted in creation of various forks.
Today we have MySQL from MySQL, Percona (XtraDB) MySQL, OurDelta MySQL, MariaDB, Drizzle to name a few. Which brings us to the source of the probl...
I've inherited an older database that was setup with a "on update CURRENT_TIMESTAMP" put on a field that should only describe an item's creation. With PHP I have been using "timestamp=timestamp" on UPDATE clauses, but in SQLAlchemy I can't seem to force the system to use the set timestamp.
Do I have no choice and need to update the MyS...