User-defined Function: ERROR 2013 (HY000): Lost Connection To MySQL Server During Query
With mysql-4.1.1-alpha, using any User Defined Function ( UDF) at the
query execution stage, on Linux 2.6, gave me the following error:
"ERROR 2013 (HY000): Lost connection to MySQL server during query"
However, upgrading to mysql-4.1.2-alpha seemed to solve the problem.
Both versions were configured exactly as follows
../configure --with-openssl --enable-thread-safe-client --with-mysqld-ldflags
=-rdynamic
The only way I could solve this was by upgrading to 4.1.2-alpha-log. Then,
recompiling the functions, drop the old UDF functions, then, recreate.
So far so good.
Anyway, if you run into this problem, or just want more detail on the sample
User Defined Functions that come with MySQL ( /sql/udf_example.cc), I've put
my notes in the following link ( TIP 27 )
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
ERROR 2013: Lost Connection To MySQL Server During Query
I have recently installed suse 9.0 linux which has MySQL 4.0.15 as part of the distribution. After I set up my users I was able to use mysqldump and pipe it into mysql on my windows machine running 4.0.16 to dump a database to the linux box. However, now when I try to login to the linux box from another machine on the network I get a query timed out error immediately after I enter the command line to start the mysql client. mysql -h 192.168.1.2 -u cdw -pxxxxxx ERROR 2013: Lost connection to MySQL server during query The error happens with in a small fraction of a second after I type in the command. I can login from the linux machine just fine though.
Error 2013: Lost Connection To MySQL Server During Query
I have MySQL 4.1.10 running successfully on an office XP machine, but when I try to set up similar XP box at home I continually get this error: "Error 2013: Lost connection to MySQL server during query". The install went fine, and Windows XP is recognizing it as a running service. But whenever I try to connect via one of my GUI applications (e.g., MySQLFront), the error appears. I have scoured this forum and Google looking for this error, but haven't found anything helpful so far. This post ... (http://forums.mysql.com/read.php?11,10684,10684) seemed similar, but my service does not stop when I hit the error. I've lost a couple days to this problem, and I've uninstalled and reinstalled the app several times. I don't know where to go next. I need to have 4.1 running because we need the Unions and Subqueries.
Error 2013: Lost Connection To MySQL Server During Query
I have MySQL 4.1.10 running successfully on an office XP machine, but when I try to set up similar XP box at home I continually get this error: "Error 2013: Lost connection to MySQL server during query". The install went fine, and Windows XP says it has started and is running as a service. But whenever I try to connect via one of my GUI applications (e.g., MySQLFront), the error appears. I have scoured this forum and Google looking for this error, but haven't found anything helpful so far. I've lost a couple days to this problem, and I've uninstalled and reinstalled the app several times. I don't know where to go next. I need to have 4.1 running because we need the Unions and Subqueries.
Error 2013: Lost Connection To MySQL Server During Query
I get this message instantly (< 1 second) when I try to connect to the MySQL server from a remote host. I am using "mysql" at the remote client. Does not matter where the remote client is: on Solaris, on RH 7.2, on Fedora. Same thing every time. I am using the the mysqld as it comes out of the box on Red Hat Linux 8.0. I tried a google search on Error 2013, and there are a lot of responses:
Network Problem - ERROR 2013 (HY000): Lost Connection ....
I'm having problems with my MySQL server when I do queries that return a lot of data over the network. It's fine if I connect via the local UNIX socket > mysql -u root -p > SELECT * FROM users limit 100; returns 100 rows in a few seconds >SELECT * FROM users limit 1000; returns 1000 rows in a few seconds But when I try the same thing but connecting to the network port I get > mysql -u root -p -h 127.0.0.1 -P 3306 > SELECT * FROM users limit 100; returns 100 rows in a few seconds > SELECT * FROM users limit 1000; sits there for about 15 minutes and then I get the following message ERROR 2013 (HY000): Lost connection to MySQL server during query If I watch the traffic with tcpdump it sends a few packets right at the start and then doesn't appear to be sending anything for the next 15 minutes until the error appears. I'm using 5.0.27-standard-log community edition.
Lost Connection To MySQL Server During Query (error_no 2013)
I am using PHP to invoke mysql_query to my database. In most cases everything works fine and the query executes perfectly. Sometimes, I will get a burst of errors and the query will fail with the following error: Lost connection to MySQL server during query (err_no 2013)
SQL Execution Error # 2013. Response From Database: Lost Connection To MySQL Server
I'm upgrading to v4.1 from v3.2 on a Windows XP box; I did an uninstall on the previous version, but Windows services did not remove it as a service (v4.1 was logged as a new service, MySQL4). I breezed through the install process, but I get an error when I try to launch the .exe file from the command line. It says ... "ERROR 2013 (HY000): Lost connection to MySQL server during query." MySQL4 is now an automatically started service under Windows and mysqld-nt is operating in the Task Manager as a process. When I try to connect via MySQLFront, I get the following error message: "SQL execution error # 2013. Response from database: Lost connection to MySQL server during query."
Encountering 2013 Error ("Lost Connection To MySQL Server...")
I have a nightly job that performs backups on my MySQL servers. There are three production MySQL instances on different machines. My backups have been running successfully for months (until now). However, on last night's backups for one instance, a couple of database/schemas (appear to have) backed up successfully, but the larger schemas failed, as follows: ======================================= Backup of schema dhunt was successful in 0 seconds Backup of schema mysql was successful in 0 seconds Backup of schema support_appl was successful in 0 seconds Error: Backup of schema support_dict was not successful (1115 seconds): mysqldump: Got error: 2013: Lost connection to MySQL server during query when retrieving data from server Error: Backup of schema test was not successful (0 seconds): mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect ======================================= I re-ran the backup cron job with the same results. Does anyone have any troubleshooting suggestions?
UNION Causes Lost Connection ERROR 2013
I wrote a for loop to build several select statements that are combined with a UNION. When I execute one of the queries separately, it works, but when I execute the query with a UNION it returns: ERROR 2013 (HY000): Lost connection to MySQL server during query I am able to run additional queries after I get the error, so the connection is not lost. I have tried running the query with the union on MySQL Query Browser and also on the command prompt and I get the same results. Here is my query:
Lost Connection To MySQL Server During Query Socket Error On Read. WSAGetLastError Return 10054($2746)
We just migrated our MySQL database from a NetWare server running version 5.0.21 to a openSUSE box running version 5.0.45. Everything ran fine for a couple of days, then clients began losing their connections and creating new ones without the old threads being terminated. This behavior is the same for the Delphi client we use to access our database as well as the MySQL Administrator tool. I've tried adjusting connection_timeout, but overall the settings for this server are the same as the previous one that ran without issues for a year.
Error 1305 - Trying To Execute User Defined Function
In my investigation, I attempted to execute the function (named 'esp') and I started getting the error message: (from database named XQ) SELECT esp(0); Error 1305 (42000): FUNCTION XQ.esp does not exist So from there, I attempted to re-install it: CREATE FUNCTION esp RETURNS INTEGER SONAME 'mysqlExtension.so'; I then get this back from mysql: FUNCTION 'esp' already exists. I also tried in vain: DROP FUNCTION esp; same message comes back: Error 1305 (42000): FUNCTION XQ.esp does not exist Not sure where this went wrong. It was working fine then something made it go amok. In one case it says it exists, the other it does not.
Lost Connection To MySQL Server During Query / Server Has Gone Away
All of a sudden the server stopped working. When trying to execute a simple INSERT both from PHP and Query Browser, the server crashes and I get either "Lost connection to MySQL server during query" or "Server has gone away" errors. The problem started on 5.0.18, and upgrading to 5.0.41 didn't help. I'm using Windows XP SP2. I've seen quite a few posts on similar problems, but no real solutions though. Is that a bug?
Lost Connection To Mysql Server During Query
While working in application VB with MySQL this error occurs, 'lost connection to mysql server during query' Mostly this error occurs during multiple users working in exe. How to rectify this error.
Lost Connection To MySQL Server During Query
I recently installed an ubuntu LAMP server for my website and upon trying a script that uses a mysql database (which I set up the tables via phpmyadmin) and I get this error: Warning: mysql_connect(): Lost connection to MySQL server during query in /home/tanner/Desktop/bot/DoctorWho/db_connect.php on line 4 I've searched the forums and I've gotten no answers. Anyone know the answer?
Lost Connection To MySQL Server During Query
I downloaded the MySQL trail version a few month ago, it worked fine. however after i brought 1 x EMS MySQL Manager Professional (Non-commercial license) and registered but the tool doesn't work anymore... when i try to register a database and try to get it connect, it through me a error message "Lost connection to MySQL server during query". more to it... when i try to create a database at my local host, a error messate says "can't connect to MySQL server on localhost (10061)... PLease help!
Lost Connection To Mysql Server During Query
I have following problem: when I try to connect from Windows XP to mysql server (linux computer), I get the following error: Lost connection to mysql server during query. This happens when I test the connection. I have firewall in linux, so I opened the port 3306. Is there something else I need to change to make sure that the connection will work properly?
Lost Connection To Mysql Server During Query
I'm running mysql stored procedure using VB as front end. While clicking Ok button in application it calls 3 stored procedures and returns a resultset. First time it works properly. If second time clicked the error 'lost connection to mysql server during query' displayed. Third time works fine. Like this alternatively throws error message.
Lost Connection To MySQL Server During Query
After changing RAM and the ethernet card of my DB server, the problem of getting frequent: Database error (error code 102) Could not connect to database server (Lost connection to MySQL server during query) Still occurs ;/ I've tried to eliminate all factors (like multiple servers, load-balancers, replication etc) so I have wrote a php script that only does the following: - opens db connection - does a simple select - closes db connection If I refresh this page over and over, every 6-7 times I get the above error. Anyone have any further solutions, ?? I've tried the software (re-installing mysql, upgrading, etc....) and tried the hardware (RAM, ethernet card). Nothing seems to help. The DB server is Linux Redhat 7.3 with the 2.4.18-3smp kernel. I am running MySQL standard 4.0.13.
Lost Connection To MySQL Server During Query After Script Takes 60 Secs
I get the error "Lost connection to MySQL server during query" at the mysql_select_db when reaching this part of the code after 60 seconds of script execuation has already passed. Works fine if the script execution time when reaching this is under 60. Tested with Sleep() and I'm 100% sure that the 60 second barrier is causing it. I just don't know what the barrier is.////
"Lost Connection To MySQL Server During Query"
Bog standard SuSE 8.2 Linux install. I have installed mySQL (off the SuSE 8.2 distro CDs). I can connect locally, e.g: bealzebub> mysql -u root -p mysql -h localhost ....logs me in just fine. However, this: bealzebub> mysql -u root -p mysql -h bealzebub ....causes the connection to fail with: "ERROR 2013: Lost connection to MySQL server during query". Its the same if I try to log in from another machine.
"Lost Connection To MySQL Server During Query"
Hi, I wonder if anyone can help me with this. Bog standard SuSE 8.2 Linux install. I have installed mySQL (off the SuSE 8.2 distro CDs). I can connect locally, e.g: bealzebub> mysql -u root -p mysql -h localhost ....logs me in just fine. However, this: bealzebub> mysql -u root -p mysql -h bealzebub ....causes the connection to fail with: "ERROR 2013: Lost connection to MySQL server during query". Its the same if I try to log in from another machine. Anyone?
Failure Calling User-defined Function In Procedure
I have de following (a function that I created and a procedure that I also created) : This function checks if already exist a user in the table Users. If exists it returns the user's Uid, otherwise returns NULL. CREATE FUNCTION Check_User (_Username VARCHAR (64), _Password VARCHAR (64)) RETURNS SMALLINT DETERMINISTIC BEGIN DECLARE Ret_Val SMALLINT; SELECT Uid INTO Ret_Val FROM Users WHERE Username = _Username AND Password = SHA1(_Password); RETURN Ret_Val; END; The procedure makes use of the function defined above. First it check if there is a user with a particular user/password, if not then creates the new user : Code:
Lost Connection To MySQL Server
I am using PHP to invoke mysql_query to my database. In most cases everything works fine and the query executes perfectly. Sometimes, I will get a burst of errors and the query will fail with the following error: Lost connection to MySQL server during query (err_no 2013) Does anyone know what could cause this? Could this be a mysql configuration problem, or maybe some network problem?
User Defined Variable & MySQL Query
I am trying to use input from an HTML form, 'post' this numeric value and (using PHP) query it against a mySQL database. This all works if I 'manually' enter the value (eg .'100') into the code/script but I cannot amend the value via an HTML 'edit' <INPUT> box. Please find to follow my code:
Connection Error (2013) Using TCP/IP
When I try to connect to a remote MySQL server with following command: >mysql -h myhost.com -u mysql -p I'll occasionally get an error message saying: ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 104 This is quite often when I using a remote client, but never happens if I use the local client on the MySQL server. Is this a known bug or anyone knows a solution to this problem? Code:
Once Again: ERROR 2003 (HY000): Can't Connect To MySQL Server On Localhost (10022)
When I try to connect to my MySQL locally via the command line, about 19 times out of twenty, the connection fails with this note: ERROR 2003 (HY000): Can't connect to MySQL server on localhost (10022). The twentieth time the connection is there, and I'm able to maintain and build databases. That's weird, I can't see any pattern. Even weirder: the PHP-pages that use the databases log in every time without failure. I copypasted the password out of the PHP-code, to be sure I have the right password, and MySQL prompts me for the password when I enter the command 'mysql -u root -p'. But when I enter it, it fails. I've tried a lot of obvious solutions (Capslock, enter when te PHP-page is active, or not active, or was recently active, with and without firewall) and they all gave the same pattern: sometimes it works, but mostly it doesn't. Is there anyone with a bright idea to solve this situation
ERROR 2002 (HY000): Can't Connect To Local MySQL Server Through Socket
I'm trying to run MySQL, and sadly I've not had a lot of success. I'm running on a brand new Macbook (Mac OS X 10.4 - Intel). I've downloaded both MySQL 4.1 and 5.0 in attempts to run them. Both have installed (using .dmg packages), but neither has actually managed to run. I've been trying to troubleshoot the problem for hours now. Originally the error was: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (( note the difference between "/tmp" and the current "/var/lib/mysql" )) Basically, I've had lots of references to go ahead and change the my.cnf file in /etc (which at first didn't even exist... I had to copy that from somewhere else, too), as well as to search for the completely inexistent mysql.sock file that's supposedly on my drive (though I cannot seem to find it). Furthermore, I don't even have a /var/lib directory on my computer, much less a /var/lib/mysql. I don't know if I've installed something improperly or what.
Error 2003 (HY000): Can't Connect To MYSQL Server On 'localhost' (10061)
I can install MySQL 4.1.18 without problem. I also can connect and run the MySQL right after I install it. The problem is this, everytime I reboot my computer I can't run the MySQL anymore. MySQl service can no longer appear on the task manager's list. I type the following commands in the command window: Code:
New User ... Error 2003 (HY000)
I've installed MySQL on an XP machine running an Apache server. I've not got anywhere near the Apache bit yet, but following instructions on installation at ....
ERROR 2002 (HY000): Can't Connect To Local MySQL Server Through Socket '/var/lib/mysql/mysql.sock' (13)
I have a problem connecting to sql and can't find anything on the net to solve the problem. I have some sql databases running on a server. when I'm root on the server and I want to login to sql I do "mysql -ustudent -p -Dwordnet30 and it works fine. when I'm logged in with the user account on the server, i get this error message: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) so with the same user name in mysql, i can log on when i'm root, but not when i'm the user. the grant table for the user looks like this: Code:
ERROR [HY000][MySQL][MyODBC 5.00.11][MySQL] 2006 MySQL Server Has Gone Away
Hosting Package Environment: ASP.NET ver 2 MySQL 5.0 FP Extensions 2003 Progression: Developed Website Outline Developed Database in Access2003 Migrated AccessDB to MySQL @ Hosting Service using Migration Tool. Can connect using MySQL Admin tools and run queries fine and all data, relations etc. are there. PROBLEM: (The heart of the matter) Starting simple, created GridView Control using Microsoft Visual Web Developer 2005 Express, a few glitches here and there, used the MySQL Connector/ODBC v5.00.11 followed instructions. Can see database in Database Connections Window but when I try to connect the GridView Control to it I get: "Database schema could not be retrieved for this connection. Please make sure the connection settings are correct and that the database is online. ERROR [HY000][MySQL][MyODBC 5.00.11][MySQL] 2006 MySQL server has gone away" Had thought that "Microsoft Visual Web Developer 2005 Express" might be messing with the ODBC driver so thought to download the .NET Connector. That's when it all went bad. The documentation does not say how to install or use the connector or where to put the files. It seems to assume that these bits of information are common knowledge and I suppose that if I had kept up with the technology it might be. But alas I didn't and it Isn't and It Don't work.
CREATE INDEX Crashes Server (Lost Connection...)
I'm having trouble with a table I created quite a while ago and now want to add an index to. Here's what I get if I try to add an index on the host field of my table: mysql> create index Index_host on uselog(host); ERROR 2013 (HY000): Lost connection to MySQL server during query Connection was lost because the server crashed. The Windows event log has an event that says "Faulting application mysqld-nt.exe, version 0.0.0.0, faulting module mysqld-nt.exe, version 0.0.0.0, fault address 0x0017dc06." I've also tried the allegedly identical "ALTER TABLE uselog ADD INDEX Index_host(host)", as well as trying to index a different column, all with the same outcome (server crash). Thing is, I had no trouble adding an index to the same table a week or so ago. The table was smaller then (and had only one index), but even now, it's not very big by DB standards, so I can't imagine that's the problem. (My table had ~900K rows earlier today, which I pruned down to 140K rows after my first failed attempt to add the index. Puny! Only 55MB data length, according to MySQL administrator.)
How To Apply Php Or User-defined Functions Inside A Query
Instead of applying a php or user-defined function to data after fetching, I want to apply functions inside queries, not sure if this is possible. This is how it's done with MySQL function: SELECT FROM_UNIXTIME(table_articles.article_pubdate, %M %d, %Y) AS pub_date FROM... Is it possible to replace FROM_UNIXTIME() with the php function date() ? so it's something like SELECT ".date("table_articles.article_pubdate", 'F d, Y')." AS pub_date FROM... The above is just an example, actually I want to apply another user-defined function, which formats text of the field article_content.
No Index Defined Error When Query
Will anyone tell me what's wrong with the following select statement: select * from email where (MdnName like '%".$lastName."%') This query does not return anything although there are records in the database that matches the criteria. I'm querying the contents from a php page with this code: $query = "select * from email where (MdnName like '%".$lastName."%')"; $result = mysql_query($query); $num_results = mysql_num_rows($result); When I tried runing the same select statement in PHPMyAdmin, I received this error: No Index Define!
Does MySQL Support User-defined Data Types?
My group is in the process of migrating our Interbase databases to MySQL. We have numerous SQL scripts that use Interbase's CREATE DOMAIN statement (essentially creating user-defined data types) such as: CREATE DOMAIN PRIMARY_KEY AS INTEGER; CREATE DOMAIN FOREIGN_KEY AS INTEGER; CREATE DOMAIN USERNAME AS VARCHAR(20) DEFAULT USER; CREATE DOMAIN WHEN_ENTERED AS TIMESTAMP DEFAULT 'now'; CREATE DOMAIN WHEN_MODIFIED AS TIMESTAMP DEFAULT 'now'; CREATE DOMAIN NAME_TYPE AS VARCHAR(50); CREATE DOMAIN FULL_NAME_TYPE AS VARCHAR(101); CREATE DOMAIN DATE_TYPE AS CHAR(8); CREATE DOMAIN TIME_TYPE AS VARCHAR(20); CREATE DOMAIN COMMENT_TYPE AS VARCHAR(250); CREATE DOMAIN YES_NO AS CHAR(1) CHECK (VALUE IN ('Y', 'N')); CREATE DOMAIN TRUE_FALSE AS CHAR(1) CHECK (VALUE IN ('T', 'F')); I've searched the manual and couldn't find an MySQL equivalent, but it is a large book and I certainly could have missed it. I know we could just do a lot of replacing text and there are workarounds, but my boss wants to keep the original scripts as intact as possible and she asked me to look into this.
MySQL Error 2013
I set up a PHP/Apache MySql install on a Win XP machine. The server works fine, PHP is donig it's thing. When I try to fire up MySQL (version 5.0), I get the following; ERROR 2013 (HY000) Lost Connection to MySQL server during query This happens from both the command line and the admin GUI. I am quite sure of the user name and password.
Lost Connection To Mysql
i have mysql server located in in machine that used Red Hat 8.0 and my mysql server version was 3.23.58. I am trying to connect using my machine..And currently i used Red Hat Fedora...But when i am trying to connect to mysql server i got this error message..... "ERROR 2013: Lost connection to MySQL server during query" And i am also trying to killall my mysqld and start the mysql server through mysql kernel.... /usr/libexec/mysql -Sg --user=root& After that, when i tried to reconnect it, it's hang up !.....nothing to be done and i need to start my machine back to run mysql.
Lost Connection To MySQL
Ok heres a quick background on the situation. I run a large mysql orinated website, and tried splitting the load between 2 servers together connected via lan. On server 2 im running debian 3.0 testing/unstable with MySQL 4.0.24. When i try to execute a php mysql search script from Server 1 I get this error: Warning: mysql_pconnect(): Lost connection to MySQL server during query .............. Connection Error I have searched googled, and found a possible solution, which turned out did not work. I simply added these 2 lines to my /etc/hosts.allow /etc/hosts.allow mysqld : ALL : ALLOW mysqld-max : ALL : ALLOW Also I edited /etc/mysql/my.cnf and added wait_timeout 16000
Using User Defined Variables
The following works using user defined variable: mysql> SELECT count(*) FROM rpt_totalSales INTO @c; mysql> SELECT @c; +---------+ | @c | +---------+ | 4851547 | +---------+ 1 row in set (0.00 sec) However, the following fails: mysql> SHOW CREATE TABLE rpt_totalSales INTO @c; ERROR 1064 (42000): 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 'INTO @c' at line 1 Is there a work around for this?
User Defined Variables
Im trying to write an SQL file which contains SQL queries which are to be run individually one after the other. Im using user defined variables so that I can save time on having to manually insert constant values. Hope this makes sense: SET @sequence := SELECT COUNT(*) FROM tracks WHERE cd_id = 12; INSERT INTO tracks (song, artist, sequence, cd_id) SET ('Fools Gold', 'Stone Roses', @sequence, 12); Basically here Im trying to SET the value of $sequence based on the result of the select statement. So when I first run the two queries @sequence will have a zero value, the next time it will count the tracks table and will now return a value of 1, then 2, 3,4 etc. Each time I will replace the values of the INSERT query but the SET SELECT query will remain. The SELECT statement runs fine on its own but obviously Im either trying to do something that is not possible with the user-defined variables or more likely Ive got the query wrong.
User Defined Variables
trying the features of MySql 'SQL' I stumbled over this: I tried to use a variable within some sql statements and consulted chap. 9.3. User-Defined Variables of the 5.0 reference. found example: mysql> SET @a='test'; mysql> SELECT @a,(@a:=20) FROM tbl_name; So I tried the two syntax forms from MySql Query Browser and found that there was no way using the "set ..." syntax.
User Defined Variable
I'm creating a variable using the sql: select @birth := birth from president where last_name='jackson' and first_name='andrew'; I'm also getting a result with a date. But when I use this variable in any other queries, it does not give me anything. The variable does not hold any value inside it. It shows me the result as 'NULL' when I select the value for the variable in the SELECT statement.Am I missing anything here? Do I have to save the variable?
User Defined Variable Overflow
I've got a query that i'm using to dynamically generate a new query and save in a user-defined variable. Then i'm using PREPARE and EXECUTE to run the query that is saved in the variable. The problem is the query string i want to save into the variable is pretty long, and seems to be getting truncated i assume because of maximum variable size. Using the query browser it looks like the variable is a Blob and the data is getting truncated after 1024 bytes, and yet everywhere i see the blob maximum size is 2^16-1 (65,535) bytes. Anyone know why the blob is getting truncated after 1024 or a way around it? ....
Using Aliases And/or User-defined Variable
I have a problem I have tried doing with aliases and variables and neither is working. What I am trying to do is have a column determined by an expression and use that column later in the select. The docs say that aliases can't be used in a WHERE clause, but it says nothing about the SELECT part. Here's what I'm trying to do, first I tried with aliases: SELECT (expr here) as col1, (expr here) as col2, (col1*col2) as col3 from.... where.... The error I get is undefined column col1. The expressions are fairly complex which is why I don't want to jumble them all together into one gigantic expression. The ecpressions involve summing and substringing. Which I may have to do but am trying to avoid. Then I tried with variables: SELECT (@a:=expr), (@b:=expr), (@a*@b) as col1 from... where... This doesn't work because for some reason when it get to column 3, @a and @b don't have the values that were output in the first 2 columns. I tested this by putting @a, @b into the select clause. All rows have the values from the first 2 columns from the last record in the result set, NOT for the current record. The last record's values for a and b are 688 and 1, and when I output these in the select, ALL rows have values 688 and 1. Am I missing something with regards to using variables?
|