mysql

mysql Number of SQL Queries

Hi I just converted an Access Db to mysql (using Access as frontend, mysql as backend) It is a simple, 4 table database I have a Master table, and 3 linked tables to it So an Access form displays has data from: Master table (mainform) Details1 table (subform) Details2 table (subform) Details3 table (subform) The master table w...

MySQL INSERT Query

I have problem with my MySQL query: include '../inc/mysql_config.php'; $sql="INSERT INTO ordrar (id, order, namn, adress, postnummer, postort, email, status) VALUES (NULL, '$order','$namn','$adress','$postnummer', '$postort', '$email', '$email', '$status')"; mysql_query($sql); if (!mysql_query($sql)) { die('Erro...

How to use mysql IN comparison function with JDBC

This seems simple, but it is impossible to search the web for... I have a legacy application that uses JDBC directly with no frameworks, and I'm having to add some new features. I'm having issues finding out how to use the IN() function via JDBC. I would like to have a query like the following SELECT * from animals WHERE animal_name ...

mysql ORDER results BY number of occurences in a column

I have a database which will receive a whole bunch of information, but most importantly it will receive a city name for each row. Sample below: id city 1 London 2 Manchester 3 London 4 Brighton 5 Oxford 6 Oxford 7 London I want to SELECT only the city name from thi...

Distance between two points. East-west + North-south...

Hi, I need to calculate the distance between two points, but not in the regular way. I need to know 'the east to west distance' + 'the north to south distance'. I guess this is more simple then the regular 'as the crow flies' calculation but i still can't figure out how to do it. I want to do this using a MySQL query and preferably ha...

Problem storing trademark symbol from jQuery through PHP to Mysql

In a MySql text column there is a trademark ™ symbol which is displayed in an html textarea field and looks correct. A change is made to the textarea data and it is submitted via jQuery. When it arrives in PHP it appears to be translated to \u2122 and gets updated in mysql that way. When that data is now retrieved to the web page it app...

MySQL query within another query's while loop in PHP

I have the following code: $query = mysql_query("SELECT * FROM activity ORDER BY activity_time DESC LIMIT 50"); while($result = mysql_fetch_array($query)) { extract($result); if ($activity_type == "discussion") { $query = mysql_query("SELECT * FROM discussions WHERE discussion_uuid = '$activity_ref'"); while($re...

loading large tables of students, but school only identified on first line

Hi -- I'm loading large text file of high school students into MySQL, but the school itself is only identified in the first line of each text file. Like so: 897781234Metropolitan High 340098 1001X 678 AS Reading 101KAS DOE KEITH A1 340089 A 7782... Using SQL code, how can I generate a col...

Database migration through php

I have a mysql database that I am trying to migrate into another database. THey have different schema's and I have written a php script for each table of the old database in order to populate its data in to the new one. The script works just fine but the problem is that it does not move all the data. for example if I have a table and all...

MySQL Create Summary Table?

I have a table of answers to questions: table questionAnswers: user VARCHAR question VARCHAR answerValue VARCHAR Important: Users can post multiple answers to questions I want to collect how many questions a user has answered into a table: table users user VARCHAR questionsAnswered INT Important: Has to ignore ...

MYSQL Select/Group By: How do I remove a group from the result based on a value of one of it's members?

Consider the table of events below. The OrderID field is a foreign key to an Orders table. OrderID EventType TimeAdded* Processed 1 ... 3 Hours Ago 0 2 ... 5 Minutes Ago 0 1 ... 2 Hours Ago 0 1 ... 1 Hour Ago ...

Mysql query with multiple ID columns and php

Hi guys. I have 2 joined tables, each one has a primary key column named id. SELECT t1.*, t2.* from t1 join t2 on t1.fk_id=t2.id When I run the query above, both id fields are selected (t1.id and t2.id). My question is, how can I select the correct ID while I am looping through the result set? If I select $result->id, I will get t...

What's the best way to dump a MYSQL table to CSV?

Possible Duplicate: Dump a mysql database to a plaintext (CSV) backup from the command line. I prefer python, but if mysqldump works...then how can I do that? ...

How to efficiently convert long int to dotted quad IP in bash

I have a lot of IP addresses in a large mysql DB stored as long int's. I need an efficient/quick way to convert them back to an IP within a BASH shell script ( or have mysql return the results as an IP?? ). Note: specifically don't want to call perl, awk, or other 'language'. ...

SQL query error or what it can be ?

Hello i have table sitizen(id_citizen,name,sname,age,id_city) i try do query select a.name_city,b.name,b.age from city a,citizen b where a.id_city = b.id_city and b.name = 'DAVE' order by b.age desc expect result like this - NY | DAVE | 65 - NY | DAVE | 12 - NY | DAVE | 3 but see result what i can't anderstand - NY | DA...

How to Connect Python to MySQL DataBase ... ?!

Hi All, A question about connecting Python To MySQL DB: How Can I Do That ?! Link, If You Have References or ... ...

Update data into mysql database by clicking on a link

I there a way to update data into mysql database when click on a link? I want create a comment voting system on my site so when user clicks on a "Vote for this comment" link, +1 should be sent into database... How is that possible? ...

sql, join two tables

Hi, SELECT user.login, book.name FROM user LEFT JOIN book ON user.login = book.author WHERE user.login = 'peter' Now i get: peter book1 peter book2 peter book2 Bu i wish get: peter book1 book2 book2 Database: MySQL Thanks ...

Is it possible to generate a default value for a certain database column using hbm2ddl

Env: JPA 1, Hibernate 3.3.x, MySQL 5.x We auto generate database schema using hbm2ddl export operation. Would it be possible to generate a default value for a certain @Entity member during SQL generation. (e.g. archive field in mytable entity class. create table mytable ( ... 'archive‘ tinyint(1) default ’0 ’, ... ) ...

Error inserting data into mysql

I am trying to insert data from a csv file into mysql using BigDump. It stops on line 2, with the error: "Query: INSERT INTO location VALUES (1,"O1","","","",0.0000,0.0000,, ); MySQL: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '...