mysql

Mysql query won't ORDER BY date

Hi all, I am stuck with the following query, which won't order by it's date. Any help, or insight into what I am doing wrong will be much appreciated. The query is supposed to get an entry by thread_id, and then show the newest post in the thread, much like with a forum post, which it does fine. But when I try to order the results from ...

Mysql for python

I had trouble installing a local installation of mysql, so I have a connection to a remote mysql database via an IP tunnel, I connect to it via typing localhost in perl and python scripts. Something weird is happening and I want to check the connection from the command line rather than the script. Is there a BASH command line that I ca...

(mySQL) Unable to query 2 tables properly for data

I have 2 tables. One is 'page_links' and the other is 'rpp'. Table page_links is the superset of table rpp. The following is the schema of my tables: -- Table structure for table `page_links` -- CREATE TABLE IF NOT EXISTS `page_links` ( `page` varchar(255) NOT NULL, `page_link` varchar(100) NOT NULL, `heading_id` tinyint(3) uns...

MySQL AVG function for recent 15 records by date (order date desc) in every symbol

I am trying to create a statement in SQL (for a table which holds stock symbols and price on specified date) with avg of 5 day price and avg of 15 days price for each symbol. Table columns: symbol open high close date The average price is calculated from last 5 days and last 15 days. I tried this for getting 1 symbol: SELECT avg(cl...

mysql daily count grouped by one column

I have the following: SELECT COUNT(*),DAYNAME(sip_Date) AS DAY,sip_callid FROM request_line WHERE DAYNAME(sip_Date) = 'Saturday' GROUP BY sip_callid; with an output: +----------+----------+-------------------------------------+ | COUNT(*) | DAY | sip_callid | +----------+----------+--------------------...

MySQL Date and Time functions don't exist

I have installed WampServer 2.0 with MySQL 5.1.33. I can do Numeric and String functions like SELECT ABS(-2)orSELECT LOWER('ASD') but with Date and Time Functions such as SELECT CURDATE()orSELECT NOW() I get Error : no such function: CURDATE Am I doing something wrong, is there anything I need to install? Any help about where to...

how to install mysqlDb for MySQL and Python ON WINDOWS

I AM A NET DEVELOPER TRY TO INSTALL MYSQLDB FOR PYTHON I KEEP HAVING THIS ERROR MESSAGE raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb> I AM FOLLOWING THIS INSTRUCTION FROM THIS SITE <"http://sourceforge.net/project/...

Getting a Column's Max Value

Is there any tangible difference (speed/efficiency) between these statements? Assume the column is indexed. SELECT MAX(someIntColumn) AS someIntColumn or SELECT someIntColumn ORDER BY someIntColumn DESC LIMIT 1 ...

Meaning of "Select tables optimized away" in MySQL Explain plan

What is the meaning of Select tables optimized away in MySQL Explain plan? explain select count(comment_count) from wp_posts; +----+-------------+---------------------------+-----------------------------+ | id | select_type | table,type,possible_keys, | Extra | | | | key,key_len,ref,rows | ...

How do I format numbers to have only two decimal places?

I want that real numbers would be for example 12.92, but not 12.9241. Is it possible to do like that? ...

server is disconneting database....

database get connected successfully....but... here is my code <?php $host = 'localhost'; $user = 'root'; $pass = ''; $db = 'databasename'; mysql_connect($host, $user, $pass) or die ("Database Not Connected"); mysql_select_db($db) or die ("Database Not Fount"); ?> but the database is regularly disconnecting and connecting after 30-4...

C API with Mysql in XCode

Dear All, Setup: Running Mac OSX Snow Leopard, X Code 3.2.1, Mysql 5.1.42 and Mysql C-Connector 6.0.2, all 64-bit. I am having real difficulty configuring X-Code to run Mysql scripts. XCode is running fine (i.e. can Build and Run), MySQL server is running and I am confident on the installation of the programs listed under my Setup at t...

Creating CFArray from MySQL Result Array

Is there an easy way to dump an array returned from mysql_fetch_row into a CFArray? (part of the PHP implementation of CFPropertyList) I'm bummed by the lack of documentation on CFPropertyList for PHP. Iterating through each item in the array seems inefficient. I'm open to using a different mysql_fetch_... command. I'd like to just say:...

MYSQL Query Help

I need to get a SQL Query that I can execute to extract certain data. Here are the details: DB Type: MySQL DB Name: adminDB Table Name: licenseinfo Field Name: LicenseNumber So the data in the LicenseNumber Column looks like this: ( this is just a sample there are 300,000 Records) SSCY-334-0W2-5AA SSCY-238-2W1-5F9 SSCY-378-0W5-...

mysql compare table values

i am creating a poll in php. i have a table with an id column. when a user submits a choice, i want the php to first query the db and check whether the table "id" has the id of the current user. i am pretty new at mysql. can someone help me with the query? thanks a lot. ...

Associating tables in PHP + MySql

So, i'm creating a money management system. My database has 2 tables: main(id,timestamp,value1,value2) and fields(value1,value2). Value1 and value2 are the categories in which the money are spent. In fact, the script display a table where the rows are the days and the columns are the fields where the money have been spent into (sport, ...

Change a field across many MySQL tables

Scenario: I have users that want to be able to change their username (unfortunately I didn't think about adding this functionality when I started the site), but the MySQL database has 110 tables. Am I going to have to just make a script that executes 110 queries to update the username in each table (and remember to update the script whe...

Expanding mySQL query to include more content

I have a MySQL query that selects content created by friends of the current user and lists that content in reverse chronological order. SELECT node.nid AS nid, node.created AS node_created FROM node node LEFT JOIN user_relationships user_relationships ON node.uid = user_relationships.requestee_id LEFT JOIN users users_user_re...

osx mysql gui with plain text output?

Is there an osx mysql gui, which can run a script containing multiple statements, and will display the plain text output from the database, rather than in an excel like grid? I want to be able to see error messages and multiple sets of data all in the same window as I can when using the windows sql server client. Sequel pro seems to ge...

Can I get a little help on this php/javascript voting code?

Hi folks, This is a continuation of this question: http://stackoverflow.com/questions/1987811/move-div-based-on-user-voting I first posted the question as an unregistered user, and then later registered, so I couldn't edit or add to my original question... Justin Johnson really helped me out with the code, but I'm still having a proble...