mysql

MySQL: Getting results present in one time frame but not in another time frame.

I have generated a dataset that contains data spanning thirty days. Im trying to issolate new data elements that have appeared in the last 2 days but not in the previous 28 days before that. I run a PHP script that generates the test data. (PHP and MYSQL return the same time when tested) I run the following query against it. Results a...

Simple mysql query (i think) - select multiple rows into 1 field

I have two tables, Profiles and ProfileInformation. Any profile may have multiple entries in ProfileInformation. I am trying to create a query that takes all of the profile information for a specific profile and put it in to a single field, for example: Profile[0] has 3 corresponding records in ProfileInformation, lets say phone numbe...

How do I use mysql compress() / uncompress() with hibernate?

How do I use mysql's compress() and uncompress() functions to compress text before I store it and uncompress it when I retrieve it using a mysql database with hibernate for ORM? ...

MySQL Log Administration - Protection against developers

I'm working on logs for a customer service application. Another guy who is not a very experienced developer is working on other things, but we're both in the same database. He has some friends that work in Customer Service. I don't think he'd delete logs, but I want to be sure that if logs were deleted, we'd know about it. Is it poss...

Can You Import an Excel File to a MySQL Database using phpMyAdmin?

Can You Import an Excel File to a MySQL Database using phpMyAdmin? I am looking to buy this database that has the data of all Colleges and Universities in the US. The file is in Excel format. Can this be imported into phpMyAdmin? Here is the site where I am going to buy the database from if this is possible: http://www.data-lists.com/u...

BizTalk 2009 Community ODBC Adapter - Problem Generating Schemas from MySQL Stored Procedure

Hi, I am am currently trying out the Community ODBC Adapter (from TwoConnect) to call stored procedures on a MySQL database. I have been able to use the MySQL ODBC driver to connect to the database, but when generating the schemas for a stored procedure with input parameters I am getting the following error: Incorrect Number of argum...

Host my wordpress site locally using the server database

I have set up my wordpress site on my local machine and I would like it to talk to the live mysql database on the server. I accessed the wp-config.php file on my machine and changed the hostname to use the ip address instead of localhost, but it will not work. What do I need to do? ...

Query Optimization using WHERE IN

I'm wondering if someone can explain how the IN calculates? Well, ultimately I'm trying to find out why this query is slow and how to optimize it. I waited over 3 minutes and when I cancelled the query it had only returned 1000 lines which doesn't seem like it should take that long. SELECT t2.* FROM report_tables.roc_test_results as ...

PHP - MySQL display highest ID number

What SQL query would I use to display the newest entry? Details: id is the primary field. I have other fields but that are not related to when they were added. ...

PHP/MySQL How to make my comments and replies display correctly?

I'm trying to display my comments and my comments replies on my web page but I can't get the replies to display with the correct comment can some one help correct this problem? And by the way all the if else statements are to display different colors for the commenter or replier if he or she is the page creator or user. Here is the My...

Mysql php class

I wrote a class to create an automated connection with MySQL and create queries. Here's how it looks like: include("constants.php"); class MySQLDB { var $connection; function __construct() { $this->connection = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_...

CodeIgniter: How to use WHERE clause and OR clause

Hey! I am using the following code to select from a MySQL database with a Code Igniter webapp: $query = $this->db->get_where('mytable',array('id'=>10)); This works great! But I want to write the following MySQL statement using the CI library? SELECT * FROM `mytable` WHERE `id`='10' OR `field`='value' Any ideas? Thanks! ...

header information showing instead of page

when loading query results into a page using jquery load() I recieve header information and funny characters on my page. What could be the cause of this? In addition to this Firefox and Chrome only show this error. IE8 is fine. When clicking around the site instead of opening pages, the download dialogue opens - which tries to download a...

MySQL select specific cols slower than select *

My MySQL is not strong, so please forgive any rookie mistakes. Short version: SELECT locId,count,avg FROM destAgg_geo is significantly slower than SELECT * from destAgg_geo prtt.destAgg is a table keyed on dst_ip (PRIMARY) mysql> describe prtt.destAgg; +---------+------------------+------+-----+---------+-------+ | Field | Type ...

what this sql does

I have this as a sql statement. What does it do IF(`table`.`field1` IS NULL, '', GROUP_CONCAT(DISTINCT `table`.`field1` ASC SEPARATOR ',') ) AS `MyNewFields`, ...

Log SQL queries in production?

I'm having a dilemma on whether or not to log SQL queries in production as well. I don't know how slow writing files is in PHP. Probably some benchmarks could give some answers, but I wanted to see what you guys think before. What does or does not make the process slow? Or what things could it depend on? ...

Creating table with Identity related too other column in table

I'm trying to create a table that has a primary key (Department_ID) that auto assigns(not hard). However the assignment would be based on the exsisting value in another column(Department_Name). So for example if its the department_name payroll the department_ID would be 1 for example. If I tried to insert into and had to add another payr...

How to Count Total Number of Records and Display?

$sql = "select count(userId) from tblUser"; $result=mysql_query($sql,$link)or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_NUM); echo $row[1]; print_r($row); is displaying no of records but whu echo is not working ...

CREATE VIEW for MYSQL for last 30 days

I know i am writing query's wrong and when we get a lot of traffic, our database gets hit HARD and the page slows to a grind... I think I need to write queries based on CREATE VIEW from the last 30 days from the CURDATE ?? But not sure where to begin or if this will be MORE efficient query for the database? Anyways, here is a sample qu...

SQL - How to batch update given the results of a select

I've got a select statement that joins a couple of tables and grabs some information. I'd like to updated all of the records on one of those tables (found in the select) with information contained in the select. The select looks like this: SELECT account.id document.id FROM customer INNER JOIN account ON (custome...