Hi,
I have two tables - 'business' and 'business_contacts'.
The business_contact table has a many-to-one relationship with the business table. Furthermore, each business has a 'primary contact' field - which I'd assume is a one-to-many relationship with the business_contacts table.
The problem, of course, is that this creates a catch-...
Hi,
i have a table like this
ID nachname vorname
1 john doe
2 john doe
3 jim doe
4 Michael Knight
I need a query that will return all the fields (select *) from the records that have the same nachname and vorname (in this case, records 1 and 2).
Can anyone help me with this...
I am parsing a log and inserting it into either MySQL or SQLite using SQLAlchemy and Python. Right now I open a connection to the DB, and as I loop over each line, I insert it after it is parsed (This is just one big table right now, not very experienced with SQL). I then close the connection when the loop is done. The summarized code ...
I am doing a query with three tables, the problem was one table has many occurrences of id of another.
sample data:
users: id
answers:
id:1
user_answer :1
id:1
user_answer :2
id:1
user_answer :3
Questions:
id:1
answers :answer description
id:2
answers :answer description
id:3
answers :answer description
How can I get all user inf...
Hello, I'm working on getting my ASP.Net project working on Linux. I've been testing my code using XSP on windows, but now I am trying to make sure that I can develop and test on Linux as well. To that end I've gotten Ubuntu running and have MonoDevelop and MySQL running. I've downloaded the latest MySQL Connector/Net and I think I have ...
Hi to all,
I am hoping someone can give me pointers as to where I'm going wrong with clustering 3 servers with MySQL Cluster 7.1 with multiple management nodes.
Currently, the cluster works perfectly with one management node. This is the setup:
First server runs only an instance of ndb_mgmd (192.168.66.114)
Second server runs an insta...
Hi,
i've a rails app that runs using utf-8. It uses a mysql database, all tables with mysql's default charset and collation (i.e. latin1). Therefore the latin1 tables contain utf-8 data. Sure, that's not nice, but i'm not really interested in it. Everything works fine, because the connection encoding is latin1 as well and therefore mysq...
I would like to take a database of say, 1000 users and select 20 random ones (ORDER BY rand(),LIMIT 20) then order the resulting set by the names. I came up with the following query which is not working like I hoped.
SELECT * FROM users WHERE 1 ORDER BY rand(), name ASC LIMIT 20
...
I have a field in my database that stores the datetime that an item was added to the database. If I want to sort the items in reverse chronological order I would expect that doing ORDER by date_added DESC would do the trick. But this seems not to work. I also tried ORDER by UNIX_TIMESTAMP(date_added) but this still did not sort the resul...
Hi,
I've got two tables, e.g. table_1 and table_2. I want to Select the foreign key from table_2 with the id from table_1 but the value of the foreign key in table_2 is the id from table_1 with a prefix.
table_1.id = 1
table_2.fk_id = fk1
How do I add a value to the id so I can select the fk?
Thanks!
Peter
...
I have a view with some joins in it. I'm doing a select from that view with COUNT(*) as one of the columns of the select. I'm surprised by the number it's returning. Note that there is no GROUP BY nor aggregate column statement in the source view that the query is drawing from.
How can I take it apart to see how it arrives at this numb...
I have a SQL table (MYSQL 4.0 to be precise) composed of the following :
int no (primary)
int field1
int field2
I would like to swap the values of field1 with the values of field2 and vice-versa.
Ex.: 1;2.5;3.76 becomes 1;3.76;2.5
I need a swapping temporary variable of some sort. But I don't think I can use something like
Set @va...
hi,
I want to insert some data into a table
(id PK autoincrement, val)
with use multi insert
INSERT INTO tab (val) VALUES (1), (2), (3)
Is it possible to obtain a table of last inserted ids?
I'm asking becouse I'm not sure if all will in this form: (n, n+1, n+2).
I use mysql inodb.
...
I'm trying to update some info into database but for some reasons it doesn't update. Also I'm not getting error in the server logs.
mysql_query("UPDATE `view_item` SET
`item_number` = $item_number,
`title` = $title,
`price` = $price,
`shipping` = $shipping,
`location...
We are running MySQL on a Windows 2003 Server Enterpise Edition box. MySQL is about the only program running on the box. We have approx. 8 slaves replicated to it, but my understanding is that having multiple slaves connecting to the same master does not significantly slow down performance, if at all. The master server has 16G RAM, 10...
Hello Guys,
I need to setup testing LAMP environment in my office to work with outsourcing companies.
This is what I think should be done on my side:
Setup testing web server with the same configuration as on production
Setup testing SQL server with "fake data"?
Outsourcers should have access only to some part of original code
Outso...
Hi,
Another utf-8 related problem I believe...
I am using php to update data in a mysql db then display that data elsewhere in the site. Previously I have run into utf-8 problems before where special characters are displayed as question marks when viewed in a browser but this one seems slightly different.
I have a number of records t...
Hello,
I have a slow mySQL query in my application that I need to re-write. The problem is, it's only slow on my production server and only when it's not cached. The first time I run it, it will take 12 seconds, then anytime after that it'll be 500 milliseconds.
Is there an easy way to test this query without it hitting the query cach...
I have several TEXT and/or MEDIUMTEXT fields in each of our 1000 MySQL tables. I now know that TEXT fields are written to disk rather than in memory when queried. Is that also true even if that field is not called in the query? For example, if I have a table (tbExam) with 2 fields (id int(11) and comment text) and I run SELECT id FROM...
I have two separate tables both with user id columns uid. I want to take a value from all users in one table and insert it into the correct row for the correct user in the other table.
INSERT INTO users2 (picture)
SELECT pv.value
FROM profile_values as pv, users2 as u
WHERE pv.uid = u.uid
AND pv.fid = 31
AND users2.u...