mysql

MySQL Full Outer Join Syntax Error

SELECT airline, airports.icao_code, continent, country, province, city, website FROM airlines FULL OUTER JOIN airports ON airlines.iaco_code = airports.iaco_code FULL OUTER JOIN cities ON airports.city_id = cities.city_id FULL OUTER JOIN provinces ON cities.province_id = provinces.province_id FULL OUTER JOIN countries ON cities.countr...

mysql_store_result() @ MySQL C API - does it really allocate memory in each call?

Hi! I've read that mysql_store_result() in the MySQL C API will allocate memory for each and every call to it; mysql_store_result() reads the entire result of a query to the client, allocates a MYSQL_RES structure, and places the result into this structure. It is really so? I'm asking because I'm about to call it many times in a serv...

MySQL: Can I Share enums?

I have 3 similar tables, that would all have the same enum type field. Is there a way I can just reuse a single enum instead of creating each (duplicate) enum? Aware of BNF/don't want to use it/small project. ...

MySQLi not returning results from a JOIN prepared statement

function fullJoinTest() { $con = ModelBase::getConnection(); $sql = "SELECT airline, airport FROM airlines LEFT JOIN airports on airlines.icao_code = airports.icao_code"; $query = $con->prepare($sql) or die("Error preparing sql in Search (test) "); $query->execute() or die("Error executing query i...

Editing MySQL system table

Hi, After modifying mysql user table (mysql.user) by adding a new field ALTER TABLE mysql.user ADD id integer(11) unsigned FIRST; and restarting the mysql daemon, it is now impossible to log in as any user. My question is what mecanism does mysql uses that prevents its core system tables from being altered? I can understand that it ...

MySql table names and field names within quotations.

I have a bunch of PHP code that is auto-generated and it puts all table names and field names within quotes. To wit: INSERT INTO "t_ML_u_Visitor"("c_u_ID") VALUES ... Since the code is Auto-Generated it would be much preferred if I could somehow get MySql to accept this syntax rather than subjecting the generated code to a post-proce...

Iterate 50 times over an SQL command

I want to make propotion codes for my product. I have created an appropriate SQL statement which basically uses the current timestamp and runs SHA1 on it. I tried a while ago to create an iterative loop over my INSERT command but failed anyone know how? Do 50 times INSERT INTO ...... end Also, I cannot have two of the same promo...

how to migrate DB from MySql to MS-SQL?

i want to migrate my whole DB from MySQL to MS-Sql server. though i am open to use any tool,am restricted to use only free avilable tools. ...

Select longest common timerange

Hi, I have a table where I have datetimes associated with an ID: ┌────────────────┬──────────────────────┐ │ location_id | datetime | ├────────────────┼──────────────────────┤ │ 200333 | 2008-01-01 00:00:00 | │ 200333 | 2008-01-01 01:00:00 | │ 200333 | 2008-01-01 02:00:00 | | ... | ....

Auto-suggest with quick response using PHP/KohanaPHP + MySQL + jQuery

I need to know how to execute this in the best way possible so that the suggestions will load really quick and secured. I want something like how the Related Questions work here after typing a question title. ...

MYSQL order by insists on using filesort.

Hi All. I need to optimize a MYSQL query doing an order by. No matter what I do, mysql ends up doing a filesort instead of using the index. Here's my table ddl... (Yes, In this case the DAYSTAMP and TIMESTAMP columns are exactly the same). CREATE TABLE DB_PROBE.TBL_PROBE_DAILY ( DAYSTAMP date NOT NULL, TIMESTAMP date NOT NULL, SOURCE_...

how to store the mysql query result into a local csv file ?

how to store the mysql query result into a local csv file ? edit 2 : because i dont have access in the remote machine . ...

Asp.net MVC with mysql

I am using ASP MVC to develop a new project. I am using the repository pattern for Data Access. I have worked on the same scenario before using SQL Server, but now I'm using MySQL. How do I interact with MySQL using the repository pattern? ...

How to set timeout in mysql c++ connector

I am using c++ connector to connect to MySQL server. When server is offline or in sleep,the statement execute method takes a while to detect the connection problem. Is there a method or variable to control the waiting timeout period in client? Regards Devara Gudda ...

Deleting duplicates from a large table

Hi, I have quite a large table with 19 000 000 records, and I have problem with duplicate rows. There's a lot of similar questions even here in SO, but none of them seems to give me a satisfactory answer. Some points to consider: Row uniqueness is determined by two columns, location_id and datetime. I'd like to keep the execution time...

Best free mysql admin tool

I am looking for best mysql admin tool. I have used MySQLAdmin and Toad for Mysql.... MySQLAdmin in not that good, and Toad keeps on firing exceptions... Which tool do you use? Can you please share it with me? Thanks and Regards ...

Timeline from 2 related tables

Let's say I have a screenshots table and a replies table. So: every screenshot can have multiple replies (one-to-many). Now, I want to create a combined timeline of the two, but in reality, they're pretty unrelated (in structure). How can I select data from both tables, ordering by their publish time, descending; when for example, I can...

what if int data type in mysql reaches limit while insert records?

Although using daily in my programming , but never realized about this question : since the int(unsigned) data type can hold values from 0 to 4294967295, what actually happens If I declare this INT fields to be auto increment and one morning, it just reaches 4294967295? The obvious answer will be it should throw an error that cannot in...

mySQL recursive Count()

I have an issue regarding an recursive count which works well in SQL server, but I can not make this work in mySQL. In SQL Server I used to use: SELECT @Param= not_unique_id, (Select Count(not unique id) FROM TABLE0 WHERE not_unique_id=@Param) FROM Table0 WHERE ..... this will give me: 1 2 1 2 2 1 3 3 3 3 3 3 this will give me...

declaring constraint to consider prog logic

I can open a trip only once but can close it multiple times. I can not declare the Trip_no + status as primary key since there can be multiple entries while closing the trip. Is there any way that will assure me that a trip number is opened only once? For e.g. there should not be the second row with "Open" status for trip No. 3 since it...