mysql

cannot create mysql database using cmd

I have this on my batch file: drop database if exists inventory; create database inventory; use inventory; mysql -u root -p inventory < C:\wamp\www\test\inventory.sql And I already copied all the contents of C:\wamp\bin\mysql\mysql5.1.36\bin Into C:\windows\system32 Just to make sure that it has the file that it needs to...

PHP MYSQL order by day and month...HELP please..

Hi i have my mysql $query = mysql_query('SELECT * from rbf_edades_news order by month DESC '.$limit.''); month and day are in different fields, any idea?" is this possible $query = mysql_query('SELECT * from rbf_edades_news order by month and DESC '.$limit.''); Thanks! ...

MySQL prepared statements vs simple queries performance

I made a few tests, first I tested mysql prepared statement with $pdo->prepare() and $insert_sth->execute() for 10k inserts (with named parameters if it matters), and it took 301s. After that I made simple insert queries and inserting each time for the same 10k inserts too and it took 303s. So I would like to know: does prepared state...

Specific Date Format in mysql

Using MySQL Table ID Date 001 2010-05-01 002 2010-06-08 Query Select ID, Date from table; I want to display a date in a specific format Expected Output ID Date 001 01-Mar-2010 002 08-June-2010 How to make a query in mysql. Need Query Help ...

Less than or Equal Date should not allow to enter

Using C# & Mysql When i get the input date in the textbox it should compare with date from table, if it is equal it should throw error message, it should allow only the greater than date For Example Table1 ID Date 001 2010-08-05 002 2010-08-02 .... When i enter the date in the textbox like - 2010-08-04, it should compare with Date ...

how to extract the field type of a mysql column without using mysql_field_type

I am writing a code where I extract information from tables by entering the query in a php page. So if i write a sql statement in the search box, it would give me the result. The problem: The mysql statement could be anything that the user enters as explained above. There are a few columns that repeat across tables like that of entered...

Sql-Query: Hiding letters after space in the output

Hello all, I've got a problem and hope you can help me find a solution. Name Hours title Name1 12 #1 (Text) - text - text Name2 13 #1545 (text) - text - text Name5 19 #33558 (text) - text - text Name6 36 #54123 (text) – text This is an extract from following query: SELECT name AS Name, Sum((Unix_Timestamp(end)-U...

complex group by mysql query

I have a table with the following rows: id. user_id, type - link 1. 555, image - http://1 2. 555, image - http://2 3. 654, image - http://3 4. 245, video - http://.. 5. 555, image - http://.. 6. 878, text - http://.. I want to group the type (image) by date, so they show as single row. In this example, the first two images ...

Query optimization : Which SELECT syntax is faster?

Hello, Given 5,000 IDs of records fetch in the database, which query , in your opinion is faster? Loop through 5000 IDs using php and perform a SELECT query for each one, foreach($ids as $id){ // do the query $r = mysql_query("SELECT * FROM TABLE WHERE ID = {$id}"); } Or collect all ids in an array, and use SELECT * FROM TABLE...

CodeIgniter better script flow for Query

Hi there, I've the following data: promo_id date time reg_cnt notes 2760 2010-06-02 01:30:00 2 - 2760 2010-06-02 05:30:00 2 - 2760 2010-06-03 07:00:00 1 - 2760 2010-06-03 07:30:00 2 - 2760 2010-06-03 08:30:00 3 - 2760 2010-06-04 09:00:00 1280 promo from vendor xxx 2760 ...

How to store an array into mysql?

Is there a way to store an array into mysql field? I'm creating a comment rating system so I want to store the arrays of user ids to prevent multiple votings. I'm going to create new table that holds the comment id and the array of user ids who have voted on this comment. Than I'll join comments table and this table and check whether the...

Is a CLUSTER INDEX desireable when loading a sorted loadfile into a new table?

INFORMIX-SE: My users periodically run an SQL script [REORG.SQL] which unloads all rows from a table in sorted order to two separate files (actives and inactives), drops the table, re-creates the table, loads the sorted loadfiles back into it, creates a cluster index on the same column I sorted my unload files by, creates other supporti...

Mysql: How to select distinct values from a database column

Hi friends, My goal is to select value from "EmbedImgDimension" column where in lots of duplicated values are present. I have used the following query select distinct EmbedImgId, VideoID, EmbedImgHeight, EmbedImgWidth, EmbedImgFileName, concat(embedimgwidth,' x ',embedimgheight) as EmbedImgDimension from embedimages inn...

MySQL - Convert MM/DD/YY to Unix timestamp

The title says it all; is there an easy (single query) way to do this? I'm reading those values from a column in a table and I think that the column itself is defined as a string (can't be helped, i'm afraid). Thanks guys. ...

dispaying top 10 players and monthly top 10 players using php mysql

Hi, I am currently working for a highscore system for my games website. and i have written the code for that. it only displays 1- players. i want to display overall top players when i click on top players url and want to display the monthly top 10 players when i click on monthly top players url.How to do this. i am trying since 2 days. i...

Managing mysql schema changes with SQL scripts and transactions

Hi all I am working with multiple databases in a PHP/MySQL application. I have development, testing, staging and production databases to keep in sync. Currently we're still building the thing, so it's easy to keep them in sync. I use my dev db as the master and when I want to update the others I just nuke them and recreate them from m...

mysql server: stored procedures - when do i create the stored procedures?

Hello. I found tutorials on creating a stored procedures on the net, I just don't understand when exactly do I need to execute the creation of the stored procedure. do the stored procedures creation should be executed each time i restart my MySQL server ? do I need to execute the stored procedures creation sql each time I start my app...

Is there a way to grab files from other servers and dump them into the DB asynchronous?

Hello guys, I need to create a php script that takes lots of URL's via POST and then loads the corresponding files and dumps them in the DB. The thing is that I would like to do it asynchronous, so that if I have 1000 files to get, the script won't hang till all the files are loaded. Also, every time a file it's done loading, I need to ...

mysql with the date function

Hi I have a mysql table containing a field name dtt_date and have values like 08/04/2010 22:15:00. I want to display all the records with in this month (08, august), How to write a mysql query in my php page to display these record. Does any one know this? Please help me? ...

Django drop all tables from database

How can I drop all tables from database using mannage.py and command line? Is there any way to do that executing manage.py with appropriate parameters so that to execute it from .NET application? ...