MySQL is an open-source, relational database management system.

learn more… | top users | synonyms (3) | mysql jobs

0
votes
0answers
14 views

Mysql: Improve performance pulling data across country

I just want to know what is the best way to improve pulling data where my database is in West continent while my server is here in East. Lets say i am pulling 2k+ rows and my query is joining 3 ...
0
votes
1answer
14 views

how to add column name present in the list object into table

how to do like this cursor.execute("create table" + config.table + config.cols) all the config names are in different files and cols is a list object like this cols = [ "name varchar(50)", ...
0
votes
0answers
18 views

java.sql.Timestamp error when inserting into DATETIME

When I try to use a java.sql.Timestamp value to insert into a DATETIME column in MySQL 5.6, I always get this error: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: ...
0
votes
0answers
13 views

Take timestamp to relative time

Can someone tell me, step by step, how to take my timestamp in my database and transform it in relative time on my website? I'm on that problem since 8 this morning and I'm actually raging. Thanks!
0
votes
0answers
18 views

My SQL query to refresh the value of a column after passing a week

|User_ID |Weekly_Score|Total_Score| this is my table and User_ID is primary key. How should I write a query to refresh the value in Weekly_score to 0 with the start of new week? (Last week score ...
0
votes
2answers
14 views

mysql_query to only show posts by the user

I'm creating a twitter-like stream of posts using PHP. If the user only wants to see posts that he created, how should I write the mysql query? Here's what I have now: mysql_query("SELECT * FROM ...
1
vote
1answer
25 views

How to base a loop on columns instead of rows?

I have a tournament/ladder script and the DB contains a separate table for every tournament. For each round in the tournament there is a "position" and "score" column. So for example, if I was running ...
0
votes
2answers
29 views

MySQL UPDATE multiple tables at once

I've a million different answers to this question and they all seem different. There must be some way of explaining this in a simple manner? If you have two tables like so: Exhibition ID * DESC ...
0
votes
1answer
8 views

ERROR 1005 (HY000): Can't create table 'db.grades' (errno: 150)

I create four tables in mysql. But it shows the error when creating the 4th. ERROR 1005 (HY000): Can't create table 'db.grades' (errno: 150) I checked the name and type is right for the foreign ...
0
votes
1answer
18 views

mysql select order by primary key. Performance

I have a table 'tbl' something like that: ID bigint(20) - primary key, autoincrement field1 field2 field3 That table has 600k+ rows. Query: SELECT * from tbl ORDER by ID LIMIT 600000, 1 takes 1.68 ...
0
votes
3answers
24 views

dynamically generate mysql query with php

I'm trying to learn how to dynamically generate a mysql query based on the form fields that a user chooses to fill with data. In-order to make the learning process as easy as possible I'm using a ...
-2
votes
0answers
24 views

PHP Update Table Where It mathes GET request?

I'm new to MySQL and currently messing with a side project. Basically, it's for an application I'm working on and I will use this for basic authentication. ie. if what the user enters in the GET ...
0
votes
2answers
16 views

mySQL Transactions Java Please

I am trying to implement some sort of transaction and keep failing. Here is my code: PreparedStatement ac = con.prepareStatement("UPDATE Stock " + "SET Stock= Stock - ('"+stockinput+"')" ...
1
vote
1answer
22 views

Selecting a subset of rows from a PHP table

I'm pretty new to using SQL, so I was hoping someone could point me in the right direction for setting up a slightly more complex query than I have needed to use in the past. I have a simple mySql ...
0
votes
2answers
21 views

Get latest entry and join another table

I'm trying to get the username and timestamp of the most recent post where topicID is, for example, 88. Users id | username --------|---------- 45234 | kaka 32663 | lenny 52366 ...
0
votes
2answers
12 views

hide empty rows inside of li

I have a li with a couple of row..I can hide row's when in db have NULL, but when have empty I don't know how can do it. this is the code I used: <ul id="responds"> <? $sql = ...
1
vote
1answer
19 views

How can I connect a PHP/Codeigniter application to a remote MySQL database via SSH tunnel?

I am refactoring a spaghetti code PHP application into the Codeigniter framework and the development version of the application is on a different server than the production database. For testing, I ...
1
vote
1answer
21 views

Improve query performance from many Master table

I have a query. I have created index for all joined key, pre-filter the master table and choose specific rows to select, but it still take long time to show(sometimes it hangs). What should We do to ...
0
votes
1answer
26 views

How to insert two values from two different dropdown to a mysql table?

one is a sub list of the other, which means the the values from these dropdown have to be inserted in the db table simultaneously. Also, these dropdwons can be added with the click of an add button. ...
0
votes
2answers
20 views

Datatype to store dates in mySQL

Quick question that I have not be able to find a good answer to. When I started with PHP and mySQL I learned to store dates/times as Unix Timestamps. The mySQL datatype was BIGINT and PHP's date ...
0
votes
0answers
12 views

CodeIgniter No rows returned from get()

I've been messing with this for a few hours now. It's got to be something dumb, but I'm just not seeing it. Why does my db->get() not return any rows? This is my first attempt at an MVC framework. ...
0
votes
2answers
24 views

Join two tables and get number of rows

I need to get the number of posts not topics, where forum_id = 1. Is this even possible? I guess I have to use join but this seems incredible hard for me. topics: id | title | forum_id posts: id | ...
2
votes
1answer
19 views

Update a Wordpress post or page takes 60+ seconds

Since updating to Wordpress 3.5 I've had my updates of pages and posts become excessively slow. I've been timing them and they take 40-80 seconds to update. I've spent the last 2 hours reading and ...
0
votes
0answers
38 views

MySQL Always Getting “Out of Memory Exception” when executing this query

I get the exception "Out of Memory" and I have ran out of ideas about how to do it. I have the following tables : create table CGNS ( CHANNEL SMALLINT NOT NULL, PNL_DATE TIMESTAMP NOT NULL, ...
0
votes
2answers
30 views

Have a column “num_posts” or querying the database

Let's say I have a forum. A small forum with maybe 100 visitors a day. Would the best way be to store the number of posts a topic has by just creating a column num_posts and each time a user makes a ...
0
votes
2answers
27 views

select data from one table, check against and pull values from second table

I have a sql query like below, which is selecting values based on if they exist in the questions table and their section_id value falls within a certain range, SELECT action_id, action_type, ...
0
votes
1answer
10 views

SQL update to pivot table and calculate new columnns

I would like to pivot/reorganize a single column containing two variables into two columns with identical indices, and calculate the difference between these variables. The below table definition ...
0
votes
1answer
15 views

PHP Scrapping…mysqli_error() expects parameter 1 to be mysqli, integer given

hey there I'm having trouble with my php code, its giving me this error when debugging it in Zend Studio 10: mysqli_error() expects parameter 1 to be mysqli, integer given (line 83) I wish to add ...
-1
votes
3answers
26 views

Java MySQL queries?

I have just installed MySQL on java, and I am trying to run dynamic queries. For example: select, delete, update, insert, countrows. Example: db.countRows("SELECT COUNT(*) AS count FROM users"); ...
-1
votes
1answer
14 views

Conversion failed when converting date and/or time from character string

I have a table column which is designed as below SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[client_Presence] ( [ClientID] [varchar](15) COLLATE ...
0
votes
1answer
13 views

SQL Update with rolling self-join

I would like to add annual growth rates to a table of annual industry sales data created as follows (essential fields): CREATE TABLE IF NOT EXISTS MarketSizes ( marketSizeID INT PRIMARY KEY ...
0
votes
4answers
45 views

The best way to display data in a table

Getting a little bit outside my comfort zone and I'm hoping someone can explain the best way of achieving what I need. This is a very simple staff attendance system. The staff table includes the ...
1
vote
3answers
32 views

php pdo query not working with array

I have been doing this for quite a few queries but suddenly found one where it is not working. Here is my code: $q = 'SELECT title FROM blog LIMIT :paging,:perpage'; $v = array( ...
0
votes
1answer
16 views

Order by frequency of occurence within a field

Is there a way in MySQL to order based on the number of times something appears inside a single field? Take the following data: id, value 1, 'Bob' 2, 'Bob Bob Bob' 3, 'Bob Bob Bob Bob' 4, 'Bob Bob' ...
1
vote
3answers
17 views

How to interpret this COBOL(?) record layout to create a MySQL TABLE?

I have this record layout for a field positional .txt database to convert into a MySQL TABLE. There is a column in the record layout titled "PICTURE" I'm not certain what it's describing for the data ...
0
votes
1answer
11 views

MySQL - GROUPING into ranges based on a SUM

Thanks in advance for taking a look at my issue. What I am trying to to is take a users transaction history and sum the revenue from all of their total orders, then group these total orders into ...
0
votes
3answers
28 views

INSERT INTO MySQL statement failing

I am dynamically forming MySQL statements in PHP and can't figure out why this one is failing to execute: INSERT INTO users ( `email`, `password`, `first_name`, `last_name`, `url`, ...
-1
votes
2answers
37 views

how to get ordered results in mysql

I have a db named library. There are authors, books, books_genres, genres, history I have more 5 books in genre with name "Horror", 3 books in genre with name "comedy" and 2 books in genre with name ...
0
votes
1answer
33 views

How can I eliminate “Out of Memory Exception” from this query?

I get the exception "Out of Memory" and I have ran out of ideas about how to do it. I have the following tables : create table CGNS ( CHANNEL SMALLINT NOT NULL, PNL_DATE TIMESTAMP NOT NULL, ...
1
vote
2answers
44 views

Is it possible to do an operation only if DATETIME is smaller than NOW() at some time interval?

I have a REPLACE INTO operation done in my database, but I would like to make it happen only if the time in that same table for that P_ID is less than 10 minutes let's say. table_a P_ID CHECK ...
1
vote
3answers
16 views

list of several names, to update their rows in the table with same information

Can somebody refresh my memory on how to build a query for this. I want to use a list of several names (first and last), to update their rows in the table with same information. for example: if I ...
0
votes
0answers
9 views

Changing settings to utilize large amount of RAM in “reading file” stage of LOAD DATA INFILE

I'm using a machine with a very large amount of RAM (24 GB) comparable to its processing power to load a large CSV file into a MariaDB database (which is essentially a MySQL database). The LOAD DATA ...
0
votes
1answer
30 views

why is mysql handling the column as primary key?

When adding new data to the mysql table I always get the error: Duplicate entry '2026-06-20' for key 'PRIMARY' Although the field "flightDate" is neither primarykey nor is it set to unique as you ...
0
votes
2answers
38 views

Using 'to' in a PHP SQL query

My SQL query is SELECT * FROM chat WHERE to = '$user_id' AND client_id = '001' LIMIT 4 For some reason that query gives me the following error: You have an error in your SQL syntax; check the manual ...
0
votes
0answers
14 views

Validate Android registration details post to MyQSL database

I created an if else statement to check for valid inputs within the email, password, and blank spaces for the text box. The functions work correctly when I test the cases , BUT it continues to post to ...
0
votes
2answers
47 views

searching for a textbox value in a particular column of database?

I have a problem in developing a query. $a = $_POST['h']; echo $a; // it gives me 'yes' My table is somewhat like: +------+-------+--------------+ | call | churn | Proposed_pkg | ...
0
votes
4answers
17 views

MySQL: detecting database change

I have a database intensive application that needs to run every couple hours. Is there a way to detect whether a given table has changed since the last time this application ran?
-3
votes
0answers
30 views

mysql get relationship with two colum in same table [on hold]

mytable in mysql refre_id user_name 1 5 5 6 5 8 6 9 I need to amount of rows that related to reference id 1 Example: 1 related to 5 5 ...
0
votes
2answers
22 views

Can't display errors on php, just white screen

I have amazon ec2 instance running Apache and running a lot of php scripts. But there is one php script that doesnt run or gives errors. for example following code displays error: <?php ...
-1
votes
0answers
51 views

comparisons between databases for extreme cases [on hold]

I have an application which has more than 100,000 user logged in at a time. The database is used to load the user info, blogging etc. There are around a 5 tables created every day for managing the ...

1 2 3 4 5 3461