Running Two SUM
SELECT SUM(nlamount WHERE nlaccount='3202' THEN 1 ELSE 0 END) AS receivables, SUM(nlamount WHERE nlaccount='3207' THEN 1 ELSE 0 END) AS receivablesvat
FROM nominalledger
WHERE nlcompanyid=$companyid
AND nldate >= $company_end_year
GROUP BY nlcompanyid
I want to run this script, I basically want to add up nlamount twice, when nlaccount=3202 and nlaccount =3207
i have got te syntax wrong though in the SUM command, I have tried googling it, but there are only basic tutorials in sql outside the SUM instead of inside the SUM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Help Please Running Mysql On Os X
I am very new to mysql. I am using the sitepoint book 'Build your own Database Driven Website using PHP and MYSQL. I have installed mysql mysql-5.0.41-osx10.3-powerpc. Under preferences/mysql it indicates that the mysql server is running. When I try to access mysql through the terminal window I get a message - command not found. Or no permissions. I can go to the bin directory and list the contents - they seem to be there. I can't get past page 21/22 Post-installation setup tasks. I am also new to using the terminal window. I suspect I have missed something really basic - any suggestions on how I can get up and running would be much appreciated!
Need Some Help In Getting MySQL Set Up And Running.
I wasn't sure if someone would be able and willing to help me, but I am new to installing MySQL on a Windows 2003 server (actually .. any server), but I am installing it on a Windows 2003 server right now. I also installed a new version of PHP on the same server. Everything looks fine, but when I go to phpinfo.php I don't see anything saying MySQL. (I saw somewhere that if MySQL is installed properly, it should be displayed on the phpinfo.php page.) I am currently trying to set up and run Cerberus Help Desk, but it isn't finding the MySQL database that I installed. So, I would really appreciate it if someone could not just help me via email or postings in here, but actually by using Instant Messenger (AOL, Yahoo! or MSN) to walk me through the set up, testing, etc. so I can get things up and running properly. I was hoping that someone with more experience than I might be willing to help me in this manner.
Is There A Way To Calculate Running SUM
I have a table (T1) consisting of 2 columns, Date and Observerd as follows: Date Observed 4/1/07 2 4/2/07 4 4/7/07 3 4/10/07 5 4/12/07 1 4/18/07 7 4/22/07 2 and we want to write a query to create a table or a view with the following data: Date ThreeDaySum 4/1/07 9 <-- (2+4+3) 4/2/07 12 <-- (4+3+5) 4/7/07 9 <-- (3+5+1) 4/10/07 13 <-- (5+1+7) 4/12/07 10 <-- (1+7+2)
Could Not Get MySQL Running
I went to MS-DOS to start the MySQL application by typing mysqld into the bin directory of where I installed MySQL but once I did typed the command and pressed enter this is all I got : A moment passed before I am shown the path of bin with no indication of MySQL server started. And also I have installed this as a window service.
Running Average
How can I get mysql to do a running average of a given field using dates from another column so that the average for each element is for a given time period rather than from the 5 rows next to the element?
#1064 - While Running A Doc Example
I plan to use the function ADDTIME(expr1, expr2) in an SQL request. I looked at the doc and tried the normal syntax, but I have always the following error even if I enter the example from the doc, why ? #1064 - You have an error in your SQL syntax. Even if I enter SELECT ADDTIME("1997-12-31 23:59:59.999999", "1 1:1:1.000002"); I am using MySQL under Windows 2000 using EasyPHP 1.7 (Apache 1.3.27, PHP 4.3.3, MySQL 4.0.15, PhpMyAdmin 2.5.3. )
Slow Running Sql
i am not using mysql but an unknown database system on a unix box - i have no control over the database but have purchased an odbc driver that seems very 'clunky' after using mysql - this is an sql statement question rather than a mysql tech question. if i run this: SELECT MK_01_vehicleRecords.registrationnumber, MK_01_VehicleRecords.vehiclenumber FROM MK_01_VehicleRecords WHERE (MK_01_VehicleRecords.vehiclenumber = '36176')
Running MySQL 5.0
I've just downloaded and installed 5.0 on my Pc/ win 98se. When I run the program MySQL Command Line Client, it appears to run for a second then disappears. I see the program flash open for a second and then it is gone.Complete newb needs some help.
Running Balance With Where
I am using the following query: SET @bal1=0,@bal2=0,@bal3=0,@bal4=0,@bal5=0,@bal6=0; SELECT Id, Date, FCode, Descr, Debit, @bal5 := @bal5 + DebT AS RunDeb, Credit, @bal6 := @bal6 + CreT AS RunCre, @bal2 := @bal2 + net AS RunBal, Rec FROM ( select fin_records.id, fin_records.id_production_unit as PUnit, fin_records.id_bank_account as BAcc, date_format(fin_records.fin_record_date,'%d-%m-%y') as Date, fin_accounts.fin_account_code as FCode, fin_records.fin_record_desc AS Descr, fin_records.fin_record_debit AS Debit, @bal3 := fin_records.fin_record_debit AS DebT, fin_records.fin_record_credit AS Credit, @bal4 := fin_records.fin_record_credit AS CreT, @bal1 := fin_records.fin_record_debit - fin_records.fin_record_credit AS Net, fin_records.fin_record_rec AS Rec from fin_records inner join fin_accounts on fin_accounts.id=fin_records.id_fin_account where (fin_records.id_production_unit='$up') and (fin_records.id_bank_account='$ba') and (fin_record_date between makedate(year(curdate()),1) and makedate(year(curdate()),365)) order by fin_records.fin_record_date,fin_records.id ) AS tmp; I should build another column to get RunBal2, that should include only records with Rec = 1.
Running Average
How can I get mysql to do a running average of a given field using dates from another column so that the average for each element is for a given time period rather than from the 5 rows next to the element?
Mysqld Is Not Running
cannot seem to run mysql commands, although queries seem to work well as I can make databases and view tables. Hope that makes sense. I installed mySQL 5 on Windows XP and tried to stick with the default installation options and paths. I lauch mySQL from this: ""C:Program FilesMySQLMySQL Server 5.0inmysqld", enter a password (but not a username so I'm assuming that's root user), get a mysql> prompt. So far so good. The following commands do not seem to work though: mysqladmin version mysqladmin variables Typing these commands then clicking the return key brings up the -> prompt. I've checked the processes and "mysql.exe" and "mysqld-nt.exe" are running. From a c: prompt I tried to install mysqld and was told it is already running. What am I missing here? I'm sure it is something very simple... Ultimately I need to bring in a table from a SQL dump from another system. I've tried using variations of: mysql -h host -u user -p dbname < dumpfile.sql I'm combing through the docs, but still don't have a clue.
MySQL 4.1 Running
I've been running mysql 4.1 for sometime and using phpMyAdmin (v2.6.2) to administer the databases. Using php scripts I can also update/insert etc the databases (maintained on my laptop Mac OS X Tiger). Suddenly, I can't get phpMyAdmin to load in the browser. I've also tried other MySQL GUI tools like CocoaMySQL and Navicat....they won't run either. I downloaded and installed phpMyAdmin 2.6.3-pl1 as well but no improvement. Why would mysql run but the admin apps not work?
Running MySQL From A CD-ROM?
I have used PHP and MySQL for a few years now. Just today I can across an application that had a MySQL database running locally off a CD ROM. I did not know this was posible. When the application runs it starts up the MySQL database without the user even knowing they are running it. It is pretty amazing. So I want to do the same thing. Is there any documentation on how to run MySQL locally. I would like to know how to build the database and create tables under these curcumstances.
Running 4.1 And 5.0 On Linux
Question: How can I run 4.1 and 5.0 simultaneously on linux - Suse 9.3 in particular? My goal is to do no harm to my current 4.1 setup. Can the 4.1 and 5.0 rpm's play nice together? Can I use the rcmysql commands for running multiple versions?
Running Sql Scripts
In the past I have always used phpmyadmin to access my mysql database. I am now doing something on a host that does not have php my admin. Can anyone help me either: 1. setup phpmyadmin -- I downloaded and uploaded to the server but I can't seem to get the config file correct or 2. how can I upload a sql script (creating all my tables) to the database.
Running Script
I'm jumping ship from a dead beat host - but first i'm trying the import on my own machine(osX). Exported all my data from phpMyAdmin 2.5.6. I did it in SQL format - one for the structure and one for the data - to a zip file(also tried with GZip).The file starts with comments and is being interpreted as all commnets - it seems there are no carriage returns - however when i look at it in any text editor or in mySql query browser, it's formatted correctly. I can place a carriage return after a comment line and reopen the query in the query browser and everything looks ok...until the next comment. My only thought is that it must be some kind of encoding issue - but i'm pretty lost when it comes to stuff like that.I've tried from the terminal/command line as well.
Running Balance
I have to calculate running balance in a query, I am trying this: set @fin_record_bal1=0; set @fin_record_bal2=0; select id,fin_record_debit,fin_record_credit,@fin_record_bal1:=fin_record_debit-fin_record_credit,@fin_record_bal2:=@fin_record_bal1+@fin_record_bal2 from fin_records The above doesn't work in record one
Running MySQL
I have installed mysql-3.23.54-win and it all seems to have gone OK .... now i want to run it and setup a database. I dont have an icon on the desktop and there is nothing in Start - Programs ..... start it from DOS prompt via C:> C:mysqlinmysql.exe and i get error 2003 cant connect to MySQL server on localhost <10061>
Running Queries
I am running phpbb forums, and I had run into a problem. They gave me a line of code that Im am supposed to run to fix my problem. Now that creates a problem, because that line of code is wrong sql says?? Heres the code.. ALTER TABLE phpbb2_users ADD COLUMN user_timezone float DEFAULT '0' NOT NULL I think the problem lies within the user_timezone part. I get an error 1064, and also it says that the database table phpbb2_users is not there, which I am looking at
Running A Query
I'm following a guide, and it says to do this stuff in my mysql database. However, whenever I try to run it (with slight alterations to the code to try to get it to work) it always gives me a syntax error. What do I have to type exactly? Hers the code: mysql> CREATE TABLE chat -> chtime DATATIME, -> nick CHAR (10) NOT NULL, -> words CHAR (150);
Running Two Servers
--=__Part1A441A35.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit I am looking into installing 2 mysql servers on the same windows 2000 PC. From what I have found, it is usually possible to have 2 different versions on the same machine. (Usually one for testing and the other for production). However, I am trying to run 2 production servers, one for personal family info, and the other for business opportunity. Being that I just started using mysql, is it possible then to have the same version installed twice, or how do I accomplish my task?
Problem Running 4.1.1
I've tried several clean installs of 4.1.1, but each time I set a configuration, the configuration wizard tells me the server could not be started with an error code of "0". On a winxp machine using Apache 2.0.54 and PHP 4.3.11, what could be the problem?
Running 2 Msql Servers
I want to run two mysql server on the same win xp machine independent of each other: one on 3306 and one on 3309. How and what files do I have to modify to set the second server port to 3309 permanently.
Cancel A Running Query
Does anyone know if there is a way to cancel a query once it has started executing? I've thought of killing the process through "show processlist". Is there a better way (since I'm calling SQL from a Java application)?
I Get This Error While Running This Script
Query failed : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''char'' at line 1 this is the file
MySQL Is Running, But I Can't Connect
I really need some help with this. MySQL will not start on boot despite everything I've done to make sure that it is set to do so. When I start it as root from a terminal with "/usr/bin/mysqld_safe --skip-grant-tables &" I show several mysqld procs. and one mysqld_safe, but I can't connect: [root@adamsmdk madams]# ps -aux| grep mysql Warning: bad syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html root 3650 0.0 0.1 2276 664 ? S 11:09 0:00 /usr/lib/courier/authlib/authdaemond.mysql start root 3654 0.0 0.1 2316 792 ? S 11:09 0:00 /usr/lib/courier/authlib/authdaemond.mysql start root 3655 0.0 0.1 2276 664 ? S 11:09 0:00...............
Gdb Bus Error When Running App With Mysql 5.0
When linking with mysql 5.0 library, I can't no longer use gdb to debug my app anymore. It cores immediately with a bus error. I've also noticed that the size of the executable is more than doubled compared with one linked with mysql 4.0
Running Update Stats
I am trying to run an update stats command but keep getting a syntax error: Looking at the doco it looks like I can use: update stats <table_name>; but when I use: mysql> update stats x_balance; ERROR 1064: You have an error in your SQL syntax near 'x_balance' at line 1 What am I doing wrong.
Running MtSQL On A RAM Disk
I am trying to set up the same thing but have been stopped right from the get go as I can not get a larger than 2G RAM disk going (using a 64 bit Ubuntu installation). I am hoping someone who has gone through the basic set up might get me squared away to start. An offline conversation would be fine and perhaps save the rest of y'all wading through said basics.
Installing And Running Connector/J
The ExecSQL class file is a Java program that will read an SQL file and execute the SQL commands inside the file. It will populate a database based on those SQL files. But thats about where I'm having trouble, I can't get the Connector/J properly installed, so running the program is impossible. Take a look at the error: You see the commands I'm using? How can it be that the driver is not found? Its in the same folder as the class file I'm trying to run.
Running .sql Script On Server?
I just installed a .php based mailing list program, which I've never done before, and one of my instructions is to "Run the mysql.sql script to create the necessary tables in the database." I have no idea what that means or how to do it. Is there an easy set of instructions anyone can give me on this one?
Running Stats On Data
I have a table (artist_nodes) that refers to a number of keywords (around 100) (nodes table) associated with a number of artists (artists table) i.e. artist_nodes table col 1 - id_artist_node (primary key) col 2 nodeID_artist_nodes col 3 artistID_artist_nodes the content of each column is a number code that relates to the primary keys of content in the artists and nodes tables. Is there a method for counting the number of distinct values in the nodeID_artist_nodes column, summing these values, and calculating how often values occur with each other? So for example, if 1 = installation, and 45=interior and 46= exterior i am looking for the number of instances of 1, 45, and 46, and also how often each occurs with the others when associated with the same artistID (as a percentage) so the output i am looking for in php would be something like installation (1) = 35 instances (3% of sample) interior (45) = 23 instances (1% of sample) exterior (46) = 30 instances (2%) installation with interior = 10 instances (x %) installation with exterior = 20 instances (y %) installation with exterior and interior = 4 instances (z %) is there a way of doing the inverse of this, i.e seeing which keywords never occur together?
Running MySQL In RAMDisk
Have a very large database and due to performance requirements it seems that running MySQL in RAMDisk might be a good solution. Access to the database is through PHP. Any suggestions or experiences?
Running Two MySQL Versions
Actually what I want to do is remove 4.1 because I downloaded 5.0 and installed w/o removing the previous version. I now have port 3307 for 5.0. Is this a problem and how can I change it back to 3306 so e.g. when I use Apache/PHP evrything works?
MySQL Running Very Slow
I have the following INSERT SQL, which runs very slow (For 2 full days it had not done anything) on a 2 processor Compaq machine running Suse Linux. Code:
Running A Php Command A Certain Time
Is there any way that I can my php page run itself at say 12am every morning? This is so I can save the mornings beginning information in my mysql database?
On What Port Is MySQL Running?
I'm running MySQL on my Mac, and I'm trying to figure out on what port MySQL is running. What can I type into Unix terminal to figure this out? Or can I find out some other way?
Error Running Insdtall_db
Trying to install MySQL on a Solaris 10 server. After setting the permissions correctly for the directories as the directions dictate, I get the following errors when I proceed to the next step to install the tables: mysql > scripts/mysql_install_db --user=mysql scripts/mysql_install_db: !: not found Installing MySQL system tables... ERROR: 1036 Table 'db' is read only 080208 7:17:48 [ERROR] Aborting 080208 7:17:48 [Note] ./bin/mysqld: Shutdown complete Installation of system tables failed! I tried looking up some of the errors on google, but I can't figure it out. Any ideas? I know I cannot login, I get this error I believe because the service isn't working: ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (146)
Slow Running MySQL?
I'm hoping someone may have an idea what could be causing the slow loading pages of my web-site. I'm not positive, but I'm relatively sure that it's related to a problem with MySQL database. I purchased a program called Sam3 for broadcasting our radio signal over the internet. The software requires the use of MySql in order to set up web pages for our web site. The problem is, that while everything works GREAT (requests can be made from the site, songs can be searched, the history of what we've played shows up) the pages load PAINFULLY slow. Other users of this software have had no such problems so I'm at a loss. I know from testing that the PHP script for the web pages is fine, I have plenty of bandwith both upload and download available on my DSL line, and while the computer running MySQL is behind a router I have tried plugging the DSL line DIRECTLY into the host computer and it makes no difference. For all appearances it seems the problem is that it takes MySQL forever to gather and provide the information needed for these pages. Does anyone have any idea what I should be looking at to solve this problem? I do not know the MySQL program at all, so I get somewhat lost when people start throwing out technical terms, but this has been really frustrating because no one else seems to have the problem and everyone so far has just told me to check the things I've already checked.
Mysqld Running 100 Pct Cpu Usage
I am testing mysql 4.1 on a Windows Server 2003 with a website running on Internet Information Services. I installed mysqld as a service. As times goes by, mysqld begins to reach 100 pct cpu usage and doesn't goes below that, Windows usage is slow, folders opens slow, navigating locally turns to be slow, and sometimes it makes the server to freeze or restart. When this begins to happen, I executed the command "Show processlist" and I got the following result. If somebody can point me where is my mistake or where is the problem or any solutions for this, I'm still in a learning process for mysql. Code:
Error In Running Safe_mysqld
I am trying to install mysql 3.23 on redhat linux. When I ran mysql_install_db,it did create some tables but when it tried to give privilages it got the following error: ./scripts/mysql_install_db: ./bin/mysqld: /shlib/ld-bsdi.so: bad ELF interpreter : No such file or directory After that what ever utility I run like mysqladmin or mysql I am getting the same error.
MySQL Config Not Running
i'm trying to set up MySQL with IIS 7.0 on Windows Vista Home Premium. After you install MySQL, there's a check box to launch the config app. if i leave it checked, the app does not load. if i try to run the app by double-clicking its icon it gives me an error saying, "The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail." I cannot find the application event log, though.
Running Mysql From Shell
I need to run this sort of querys from shell: delete from 3dinformatica where preco = " " ; CREATE TABLE tudotest AS SELECT DISTINCT * FROM 3dinformatica; DELETE FROM 3dinformatica; INSERT INTO 3dinformatica (cr_datetime,produto,vendedor,preco,link) SELECT DISTINCT cr_datetime,produto,vendedor,preco,link FROM tudotest; DROP TABLE tudotest; i wanted to put the mysql cmd in a file like mysql.sh and run it from crontab. i have about 100 querys like that i need to run at the same time.
Running An Existing SQL File
I hope this question is not too 'newbie' to answer.. I'm reading a book (PHP and MySQL web development by Luke Welling and Laura Thomson), and am getting an error on an example script. I'm trying to create tables using an existing SQL file through MySQL. According to the book, it should be done like this: > mysql -h hostname -u username -D database -p < file.sql (I've changed the hostname, username, etc.) However, I get the same error over and over again: ERROR 1064 (42000): ... at line 1. The book didn't even mention where to put the file, I've tried all sorts of things, but can't get it to work..
Mysqld Is Not Running Properly
I have installed mysql server & client version 3.23.54a from Redhat installation 9.0. I could install the RPM 's with out any problem. I can see 'mysqld' program . But when I run it shows a message like mysqld started [ok].When I checked 'ps aux' , I could not see any process running with mysqld. Also I could not run any programs like mysqladmin etc. All of them fail. does anybody know what is the mistake ? What should I do ? Also when I try to stop mysqld it fails.
Running Mysql On Old Computers
I“m running mysql on a Pentium 166 Mhz with 16 Mb of RAM. Pretty old, right? I want to know if there is a way to improve performance. I don“t know, something about reducing the number of queries that it will respond or cutting out some features.
|