Re: Help with ORDER BY using two colomns [ solved thankyou :) ]

2008-04-08 Thread Ben Clewett
Richard, No problem, glad it works. But note: this is not scalable. If you have more than a few hundred rows, you may want to think about a better solution, like storing the order field permanetly and giving it an index :) Ben Richard wrote: Thanks, it works like a charm :) Ben Clewett

Re: Help with ORDER BY using two colomns [ solved thankyou :) ]

2008-04-08 Thread Richard
Thanks, This is for the unanswered list of questions, so the output list (not the list stored in the mysql database) should never go over 100. by scalable, do you mean alot of ressources being used or a long wait for the answer? Because I belive I Could just use a simple limit if I needed

Re: Help with ORDER BY using two colomns

2008-04-08 Thread Tim McDaniel
On Tue, 8 Apr 2008, Richard [EMAIL PROTECTED] wrote: Kristian Myllym?ki a ?crit : mysql version? http://dev.mysql.com/doc/refman/5.0/en/case-statement.html order by case when updated is not null then updated else created end desc; Hello I've tried the following with mysql 4.1.11 SELECT *

Re: Help with ORDER BY using two colomns [ solved thankyou :) ]

2008-04-08 Thread Andy Wallace
Not sure, but perhaps an even simpler method would be to consider the initial insert an update as well... so the update column would always have a value. Then the sort would (I believe) always be in the order you want, and if you need to differentiate between rows that are new vs rows that are

Re: Help with ORDER BY using two colomns [ solved thankyou :) ]

2008-04-08 Thread Ben Clewett
of the variable 'tmp_table_size'. Then the result will be pruned to the LIMIT and sent. You can see that the LIMIT does not help, MySql needs to know what the top rows will be, before it discards the bottom ones. It can't know this until all data has been gathered and sorted. This is all quite

Re: Help with ORDER BY using two colomns [ solved thankyou :) ]

2008-04-08 Thread Richard
Yes that would be easier, except that I would still have to create a tempory table to add 10 days onto the ones which have a status waiting for answer from customer and have not been answered for more than 10 days. This system is for customers who do not have an account yet to contact me. And

help with DB design / query please !

2008-04-08 Thread Nacho Garcia
orderbytime orderbytime 8 netlivin3.UC.id_conversation1 1 SIMPLE C ALL id_conversation NULL NULL NULL3 Using where im completely lost here, ill really appreciate any help. thanks.

Re: Can some one help me write it shorter?

2008-04-07 Thread Baron Schwartz
To: Natalie Warshager Cc: mysql@lists.mysql.com Subject: Re: Can some one help me write it shorter? Hi, On Thu, Apr 3, 2008 at 3:25 AM, nataliew [EMAIL PROTECTED] wrote: I need querylike this that make a row of numbers (in one execute) SELECT a from ( SELECT -1 a UNION ALL

Re: Help with db design

2008-04-07 Thread Richard Jones
Baron Schwartz wrote: Hi, This is a fine place to ask such questions. (In general you can just ask first, and people will tell you if you're off-topic). OK, thanks - I've posted the details to a new subject earlier today but it doesn't seem to have showed up yet. -- Richard Jones --

Help with a complex data model

2008-04-07 Thread Richard Jones
I have a complex application under re-development, and am stuck on the data model which is almost certainly wrong. The application is designed to handle clinical requests coming into a hospital records system. A request concerns a single patient, and can come from a hospital or a GP (general

Re: Help with db design

2008-04-06 Thread Baron Schwartz
help with MySQL database design, or is there an alternative forum. It is of course not a MySQL-specific question, and would be applicable to any relational db. Thanks. This is a fine place to ask such questions. (In general you can just ask first, and people will tell you if you're off-topic

Re: Can some one help me write it shorter?

2008-04-06 Thread Baron Schwartz
Hi, On Thu, Apr 3, 2008 at 3:25 AM, nataliew [EMAIL PROTECTED] wrote: I need querylike this that make a row of numbers (in one execute) SELECT a from ( SELECT -1 a UNION ALL SELECT -2 UNION ALL SELECT -3 UNION ALL SELECT -4 UNION ALL SELECT -5 UNION ALL SELECT -6 UNION ALL

Re: Can some one help me write it shorter?

2008-04-06 Thread Moon's Father
You can use temporary table if you want short statement. On Mon, Apr 7, 2008 at 9:24 AM, Baron Schwartz [EMAIL PROTECTED] wrote: Hi, On Thu, Apr 3, 2008 at 3:25 AM, nataliew [EMAIL PROTECTED] wrote: I need querylike this that make a row of numbers (in one execute) SELECT a from (

Can some one help me write it shorter?

2008-04-03 Thread nataliew
: http://www.nabble.com/Can-some-one-help-me-write-it-shorter--tp16467090p16467090.html Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Help with db design

2008-04-02 Thread Richard Jones
is returned, suggesting my data model is not quite correct. I haven't included either db schema or queries here due to the likely length of the posting, but would initially like to ask if this is the right forum to request help with MySQL database design, or is there an alternative forum

Re: help with a sql statement

2008-04-01 Thread paul rivers
tech user wrote: Add an alias for the subquery select * from ( select ) my_alias where dd = 3; Better, use a having clause and eliminate the subquery. Odds are it will be more efficient in MySQL. How to replace the original one with a having statement? Thanks again.

help with a sql statement

2008-03-31 Thread tech user
hello, I try to execute this sql in mysql shell,but got error as: mysql select * from (select uin,count(*) as dd from active_users where date = date_add(curdate(),interval -30 day) group by uin) where dd =3; ERROR 1248 (42000): Every derived table must have its own alias But I can execute

Re: help with a sql statement

2008-03-31 Thread paul rivers
tech user wrote: hello, I try to execute this sql in mysql shell,but got error as: mysql select * from (select uin,count(*) as dd from active_users where date = date_add(curdate(),interval -30 day) group by uin) where dd =3; ERROR 1248 (42000): Every derived table must have its own alias

Re: help with a sql statement

2008-03-31 Thread tech user
Add an alias for the subquery select * from ( select ) my_alias where dd = 3; Better, use a having clause and eliminate the subquery. Odds are it will be more efficient in MySQL. How to replace the original one with a having statement? Thanks again. Get the name you

help-a-new with query ...

2008-03-24 Thread contiw
isDefined(arguments.testOnly) and arguments.testOnly IS 1 and users.testOnly = cfqueryparam value=#arguments.testOnly# cfsqltype=CF_SQL_SMALLINT /cfif please help with the [select] and [from] (inner join?). Thank you very much

Re: help?

2008-03-23 Thread Baron Schwartz
Hi Trevor, I'm CCing the MySQL list, where you may get faster response. Also try the #mysql IRC channel on Freenode if you need help faster. Cheers Baron On Sun, Mar 23, 2008 at 2:38 PM, Trevor Smith [EMAIL PROTECTED] wrote: I realize that this is a huge favour to ask for free tech support

Help me format this statement

2008-03-11 Thread Brian Dunning
I am an idiot. table_a and table_b have exactly the same structure. How do I say this in SQL: INSERT (all records from table_a) into table_b where table_a.customer = '12' Just trying to eventually duplicate the whole table, one customer's set of records at a time. Thanks. -- MySQL

Re: Help me format this statement

2008-03-11 Thread Brian Dunning
Thanks to everyone who replied. So simple I couldn't see it. :-) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Help me format this statement

2008-03-11 Thread wim . delvaux
On Wednesday 12 March 2008 00:14:46 Brian Dunning wrote: I am an idiot. table_a and table_b have exactly the same structure. How do I say this in SQL: INSERT (all records from table_a) into table_b where table_a.customer = '12' Just trying to eventually duplicate the whole table, one

help with query

2008-03-06 Thread Nacho Garcia
Hi, im having a lot of trouble with one query, i hope someone could give me a hand with this, i would be really grateful these are the tables: TABLE friends id_usr INT id_friend INT with INDEX on (id_usr,id_friend) TABLE status id_usr INT lastConnection (other irrelevant info) with INDEX

Help with a pivot-type issue

2008-03-05 Thread roger.maynard
This may take a bit of explaining! I have a incoming table structure of PartRef AttribValue ABC0011 10.00 ABC0012 4 ABC0013 A ABC0021 12.00 ABC0022 6 ABC002

Re: Help with running MySQL 5 on OS X Leopard

2008-02-25 Thread Unnsse Khan
Yes, I did and what happens is that the 'xxx' becomes appended to the next line and the line after that asks the user for the password (which also fails). The way I got it working was this: mysql -u root -p Kindest regards, Unnsse On Feb 25, 2008, at 8:34 AM, fire9 wrote: Unnsse Khan

jdbc connection pool problem, help, thanks!

2008-02-24 Thread raybristol
, any recommendations are much appericated! PS: I posted this question on Java section but no replys :( Ray -- View this message in context: http://www.nabble.com/jdbc-connection-pool-problem%2C-help%2C-thanks%21-tp15673813p15673813.html Sent from the MySQL - General mailing list archive

Help with running MySQL 5 on OS X Leopard

2008-02-23 Thread Unnsse Khan
Hello there, I am running OS X Leopard on an Intel based iMac machine... Followed the instructions to a T and everything works as described in: http://hivelogic.com/articles/installing-mysql-on-mac-os-x/ Now, after running MySQL using launchd, when I try to login using: mysql -u root I get

Help with running MySQL 5 on OS X Leopard

2008-02-23 Thread Unnsse Khan
Hello there, I am running OS X Leopard on an Intel based iMac machine... Followed the instructions to a T and everything works as described in: http://hivelogic.com/articles/installing-mysql-on-mac-os-x/ Now, after running MySQL using launchd, when I try to login using: mysql -u root I get

RE: sql help: delete row where only related to one other row

2008-02-21 Thread roger.maynard
tables, you should not define several ON UPDATE CASCADE clauses that act on the same column in the parent table or in the child table. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 20 February 2008 12:44 To: mysql@lists.mysql.com Subject: sql help: delete row

sql help: delete row where only related to one other row

2008-02-20 Thread douglass_davis
Say I have two tables: table_a -- a_id (primary key) b_id table_b -- b_id (primary key) name there is a one to many mapping between rows in table b and rows in table a. Say I had an Id of a row in table a an (a_id, say 5). Now, what I want to do is delete the row in table_a

Re: stored procedure, parameter type help needed

2008-02-12 Thread Moon's Father
Just use the type varchar.I always use it in my regular life. On Feb 11, 2008 4:44 PM, Magne Westlie [EMAIL PROTECTED] wrote: Jerry Schwartz wrote: SELECT user_id, user_name FROM user_test WHERE user_id IN (SELECT uid FROM temp_uids); [JS] Couldn't you replace the WHERE user_id IN

Re: stored procedure, parameter type help needed

2008-02-11 Thread Magne Westlie
Jerry Schwartz wrote: SELECT user_id, user_name FROM user_test WHERE user_id IN (SELECT uid FROM temp_uids); [JS] Couldn't you replace the WHERE user_id IN (SELECT uid FROM temp_uids) with a simple JOIN? If IN is badly optimized, as I've read here, wouldn't that be more efficient? Or am I

Server Getting crashed, Any Help Comments?

2008-02-10 Thread VeeJay
Hello I am running a Freebsd server: 1. Software: Apache 1.3 mysql 5.0.27 php 4.4 2. Hardware: 2 intel procerssors 4 gb ram RAID 10 with hard drives 15K rpm I am having this problem quite often now. Apache stops responding due to mysql (my guess). And I cannot connect to mysql server:

Re: stored procedure, parameter type help needed

2008-02-08 Thread Magne Westlie
, as when it comes to speed of execution in this solution. Thanks for your help Peter. My solution (with an argument that may look weird, but I found out adding the extra paranthesis while generating the string in Python was so much easier that doing it in the sproc) (working test

RE: stored procedure, parameter type help needed

2008-02-08 Thread Jerry Schwartz
-Original Message- From: Magne Westlie [mailto:[EMAIL PROTECTED] Sent: Friday, February 08, 2008 5:37 AM To: [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Subject: Re: stored procedure, parameter type help needed Hi again, I found a way that works for the query I wanted in my sproc

stored procedure, parameter type help needed

2008-02-07 Thread Magne Westlie
Dear List, I want to create a stored procedure that runs a query using the IN operator (or is IN a function???) on values sent as argument. That is, my procedure should be called with something like: CALL get_users((1,2)); and I was hoping to implement something like this: CREATE PROCEDURE

Re: stored procedure, parameter type help needed

2008-02-07 Thread Magne Westlie
Hi, Thanks a lot Peter, that was useful and it worked fine. The only problem is that the query I actually want to use this in, is a 100 line query with lots of arguments. I don't feel to good about creating it into a bunch of strings (16) that I have to concatenate with the variables

Re: stored procedure, parameter type help needed

2008-02-07 Thread Peter Brawley
Magne, I want to create a stored procedure that runs a query using the IN operator ... See 'Variable-length argument for query IN() clause' at http://www.artfulsoftware.com/queries.php PB - Magne Westlie wrote: Dear List, I want to create a stored procedure that runs a query using

Re: stored procedure, parameter type help needed

2008-02-07 Thread Peter Brawley
Hi Magne ...the query I actually want to use this in, is a 100 line query with lots of arguments. I don't feel to good about creating it into a bunch of strings (16) that I have to concatenate with the variables inbetween. The only alternative I know for current versions of MySQL is to

Re: stored procedure, parameter type help needed

2008-02-07 Thread Peter Brawley
Magne, Sorry, the server is down at the moment, here is the entry ... To have an sproc accept a variable-length parameter list for an |IN(...)| clause in a query, code the sproc to |PREPARE| the query statement: | DROP PROCEDURE IF EXISTS passInParam; DELIMITER | CREATE PROCEDURE

Re: Need help to locate SetSRID(),Makebox2D(),Distance_Sphere()

2008-02-05 Thread Anders Karlsson
Rakesh! The distance_sphere and makebox2d functions are specific to postgis. MySQL GIS Implementation is based on the Open GIS Simple SQL Specification (read more on www.opengeospatial.com). The SetSRID is also not in the specification as far as I know (it should be, but I can't find it),

Need help to locate SetSRID(),Makebox2D(),Distance_Sphere()

2008-02-04 Thread rakesh.gupta1
Hi All I looking for the stated functions. Earlier I was using postGIS in that they are present i am wondering if I can get similar kind of method in MySql.I am Using Mysql 5.0.51a version. 1. I am trying to retrieve the distance between two geometries in the table using the following

Help with MySQL Query (2 Outer joins)

2008-01-23 Thread Raghuveer Rawat
Hi, I need some urgent for sql query.. It will be great if someone could help me.. I have ARTICLE, FAVORITE_ARTICLES, RATING Tables apart from other table USER, CHANNEL, CATEGORY etc ARTICLE table stores a user's article, FAVORITE_ARTICLES will store a user's favorite articles, and rating

executing query from the command line -- need help

2008-01-23 Thread Brown, Charles
Hello All. I'm new to mysql. I would like to issue a query from the command line and pass the result to an update done on the command line within the same script. See below. My question is how can I run a select from the command line and pass the values to an update SELECT SYS_ID, SYS_LOCATION,

RE: executing query from the command line -- need help

2008-01-23 Thread Jay Blanchard
[snip] I'm new to mysql. I would like to issue a query from the command line and pass the result to an update done on the command line within the same script. See below. My question is how can I run a select from the command line and pass the values to an update SELECT SYS_ID, SYS_LOCATION,

RE: executing query from the command line -- need help

2008-01-23 Thread Jay Blanchard
[snip] SELECT SYS_ID, SYS_LOCATION, SYS_IP FROM PROD_SERVER; UPDATE TEST_SERVER SET SYS_ID = value passed from above SYS_LOCATION = value passed from above SYS_IPADDRESS = value passed from above; [/snip] And here http://dev.mysql.com/doc/refman/5.1/en/user-variables.html --

RE: executing query from the command line -- need help

2008-01-23 Thread Jay Blanchard
[snip] Hello Jay. Thanks for your reply but where is your solution to my problem. I'm lost here. Help me -- please Thx -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 23, 2008 11:29 AM To: Brown, Charles; mysql@lists.mysql.com Subject: RE

Re: executing query from the command line -- need help

2008-01-23 Thread obed
On Jan 23, 2008 2:36 PM, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Hello Jay. Thanks for your reply but where is your solution to my problem. I'm lost here. Help me -- please Thx -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 23

RE: executing query from the command line -- need help

2008-01-23 Thread Brown, Charles
thanks -Original Message- From: obed [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 23, 2008 10:49 PM To: Jay Blanchard Cc: Brown, Charles; mysql@lists.mysql.com Subject: Re: executing query from the command line -- need help On Jan 23, 2008 2:36 PM, Jay Blanchard [EMAIL PROTECTED

Re: Select statement help

2008-01-18 Thread Baron Schwartz
Hi, On Jan 18, 2008 2:59 PM, RoryGRen [EMAIL PROTECTED] wrote: Hi all I am quite new to mySQL and have the following question I hope someone can help me with: I have a database table imported directly from MS Access with two of the field names having brackets - F(1) and S(1). I don't want

Select statement help

2008-01-18 Thread RoryGRen
Hi all I am quite new to mySQL and have the following question I hope someone can help me with: I have a database table imported directly from MS Access with two of the field names having brackets - F(1) and S(1). I don't want to change the field names, as I am simply going to import again when

[HELP] I'm looking for document about References attribute for Mysql 4.1

2008-01-17 Thread Pham Anh Tuan
Hi all, I'm looking for information about References attribute in Mysql, help me! thanks in advance. Bo

Help with HOST LOGIN PASS NAME

2008-01-15 Thread meridklt
: http://www.nabble.com/Help-with-HOST-LOGIN-PASS-NAME-tp14845571p14845571.html Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Help with HOST LOGIN PASS NAME

2008-01-15 Thread Saravanan
Hi, You don't need to change the hostname to reflect the new server if you run php from the same server. Could you post the error you get when you insert new records. Saravanan --- On Wed, 1/16/08, meridklt [EMAIL PROTECTED] wrote: From: meridklt [EMAIL PROTECTED] Subject: Help with HOST

Help with this query

2008-01-15 Thread Imran
Hi: I have a table that I need help to summarize the data. I need to be able to create one row of data for custno + prodno + period + weekno combination summarized by Invtot. Any help will be greatly appreciated. Best regards I am attaching the relevant info below: Sales

Re: Help with this query

2008-01-15 Thread Moon's Father
You can just use function sum to get what you want. On Jan 16, 2008 6:23 AM, Imran [EMAIL PROTECTED] wrote: Hi: I have a table that I need help to summarize the data. I need to be able to create one row of data for custno + prodno + period + weekno combination summarized by Invtot

Re: Help with HOST LOGIN PASS NAME

2008-01-15 Thread Moon's Father
--- On Wed, 1/16/08, meridklt [EMAIL PROTECTED] wrote: From: meridklt [EMAIL PROTECTED] Subject: Help with HOST LOGIN PASS NAME To: mysql@lists.mysql.com Date: Wednesday, January 16, 2008, 2:35 AM Firstly I know nothing about MySQL but had to move hosts and followed the export from

Mysql Help / Error Thx

2008-01-11 Thread Matthias L.
Dear Users I searched google, find alot of tips, but none of the them was successfully. After a db move with ibdata files, which cannot be dumped (cause of a table failure) we made a hardcopy of the files and moved it onto the new server. Eg. we copy ibdatafiles, the original my.cnf to the new

help with count in grouped query

2008-01-10 Thread Eben
I have this query: SELECT table.id,table.field_1,table.field_2,COUNT(table.field_1) as total FROM table WHERE MATCH table.field_1 AGAINST ('some text') GROUP BY table.field_1,table.field_2 which returns aggregate results like: 1, data..., data..., 3 2, data..., data..., 1 3, data..., data...,

Re: help with count in grouped query

2008-01-10 Thread Perrin Harkins
On Jan 10, 2008 5:40 PM, Eben [EMAIL PROTECTED] wrote: I want to be able to do count of the total records brought back by this query... but since I am using the group by I can't use COUNT() in the desired way. Assuming what you want is all the data from your current query plus an additional

Re: help wit query optimization (cont'd)

2008-01-09 Thread Sebastian Mendel
Perrin Harkins schrieb: On Jan 4, 2008 5:51 PM, Eben [EMAIL PROTECTED] wrote: The resultset is paginated on the front end using the SQL_CALC_FOUND_ROWS functionality... Usually a bad idea: http://www.mysqlperformanceblog.com/2007/08/28/to-sql_calc_found_rows-or-not-to-sql_calc_found_rows/

Re: help wit query optimization (cont'd)

2008-01-09 Thread Perrin Harkins
On Jan 9, 2008 4:33 AM, Sebastian Mendel [EMAIL PROTECTED] wrote: usually ... but i do not know of any index capable of having FULLTEXT and 'normal' fields in one index Does that matter? It would have to be doing a full scan for SQL_CALC_FOUND_ROWS to work out well. - Perrin -- MySQL

Re: help wit query optimization (cont'd)

2008-01-09 Thread Sebastian Mendel
Perrin Harkins schrieb: On Jan 9, 2008 4:33 AM, Sebastian Mendel [EMAIL PROTECTED] wrote: usually ... but i do not know of any index capable of having FULLTEXT and 'normal' fields in one index Does that matter? yes, as written in the mentioned article the test is only relevant with correct

MySQL SELECT Statement with Date help request

2008-01-09 Thread Cx Cx
Hi List, I am wondering if someone can help me with a query to check what databases are on the MySQL server and then check which of those databases are either partially or completely within the date range i require. The scenario is as follows: db1 : 2007-01-01 to 2007-02-01 db2 : 2007-02-01

Re: help wit query optimization (cont'd)

2008-01-09 Thread Perrin Harkins
On Jan 9, 2008 8:34 AM, Sebastian Mendel [EMAIL PROTECTED] wrote: yes, as written in the mentioned article the test is only relevant with correct used indexes, but MySQL does not use more than one index, so this query cannot all be done with indexes Well, first of all, MySQL 5 does use more

Re: help with query optimization

2008-01-09 Thread Brent Baisley
Your biggest problem is probably the subquery/IN your are performing. You should change that to a join. And I don't know about using SQL_CALC_FOUND_ROWS in a full text query that's not boolean, and you shouldn't use it unless you have a LIMIT clause. SELECT SQL_CALC_FOUND_ROWS

Re: MySQL SELECT Statement with Date help request

2008-01-09 Thread Brent Baisley
am wondering if someone can help me with a query to check what databases are on the MySQL server and then check which of those databases are either partially or completely within the date range i require. The scenario is as follows: db1 : 2007-01-01 to 2007-02-01 db2 : 2007-02-01 to 2007-03

SQL help/problem with timestamped data differences

2008-01-08 Thread mark carson
Hi All I have the following data example UID Timestamp 123456 20071201 12:00:01 123456 20071201 12:00:06 987654 20071201 12:00:01 987654 20071201 12:00:09 etc I need : UID Timestamp secs 123456 20071201 12:00:01

Re: SQL help/problem with timestamped data differences

2008-01-08 Thread Dan Buettner
Mark, is the 'secs' column the offset from the minimum value of the timestamp column? If so, you might try something like this: SELECT UNIX_TIMESTAMP(MIN(timestamp)) INTO @min_timestamp FROM my_table; SELECT uid, timestamp, UNIX_TIMESTAMP(timestamp) - @min_timestamp AS secs FROM my_table ORDER

help wit query optimization (cont'd)

2008-01-04 Thread Eben
I left something out, the query looks like: SELECT SQL_CALC_FOUND_ROWS table_1.id,table_2.* FROM table_2 LEFT JOIN table_1 ON table_2.shared_id = table_1.shared_id WHERE MATCH table_2.field AGAINST ('value') AND table_2.current = 1 AND table_2.shared_id IN (SELECT shared_id FROM table_1_view)

Re: help wit query optimization (cont'd)

2008-01-04 Thread Perrin Harkins
On Jan 4, 2008 5:51 PM, Eben [EMAIL PROTECTED] wrote: The resultset is paginated on the front end using the SQL_CALC_FOUND_ROWS functionality... Usually a bad idea: http://www.mysqlperformanceblog.com/2007/08/28/to-sql_calc_found_rows-or-not-to-sql_calc_found_rows/ - Perrin -- MySQL General

help with query optimization

2008-01-04 Thread Eben
Hi, I have a query that has to run on a full text indexed table with many millions of records. I'm trying to figure out some optimizations for it. Here's the general query: SELECT SQL_CALC_FOUND_ROWS table_1.id,table_2.* FROM table_2 LEFT JOIN table_1 ON table_2.shared_id =

Re: help wit query optimization (cont'd)

2008-01-04 Thread Moon's Father
I've never used this feature before on my application. On Jan 5, 2008 7:06 AM, Perrin Harkins [EMAIL PROTECTED] wrote: On Jan 4, 2008 5:51 PM, Eben [EMAIL PROTECTED] wrote: The resultset is paginated on the front end using the SQL_CALC_FOUND_ROWS functionality... Usually a bad idea:

Re: Help with query, (question simplified as last mail was very complicated to understand :))

2007-12-30 Thread Richard
Richard a écrit : Sorry about my last email which was long and not clear. This is what I want to do Join two tables on code table1 = code table3 where messageid = for example 28 table 1 contains : message from messageid --

RE: Help with query, (question simplified as last mail was very complicated to understand :))

2007-12-30 Thread Martin Gainty
not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Sun, 30 Dec 2007 13:54:32 +0100 From: [EMAIL PROTECTED] To: mysql@lists.mysql.com Subject: Re: Help with query, (question simplified as last

help with a query...

2007-12-28 Thread Richard
Hello, I'm trying to get what is for me quite a complicated query to work, if it's possible to do so anyway ... Here is my old query : SELECT a.message,a.date,b.surname,b.name,b.title FROM messages a JOIN info b ON a.from=b.code WHERE a.id='28' It worked fine untill I needed to have more than

Help with query, (question simplified as last mail was very complicated to understand :))

2007-12-28 Thread Richard
Sorry about my last email which was long and not clear. This is what I want to do Join two tables on code table1 = code table3 where messageid = for example 28 table 1 contains : message from messageid -- message1 |

Re: Another cry for help..

2007-12-22 Thread Anders Norrbring
Anders Norrbring skrev: Brent, you put me on the right track.. ;) Reading up a bit on syntax for variables, I came up with the following, which seems to work. SET @tid:=(SELECT tid FROM objects WHERE shortname = %s); SET @vid:=(SELECT vid FROM itemtypes WHERE itemtype LIKE %s); SELECT

Another cry for help..

2007-12-20 Thread Anders Norrbring
Hi.. I'm struggling with a query that I'm trying to simplify as much as possible, but I can't seem to get rid of using the very same subqueries several times. Would there be a way to optimize the following so I get rid of subqueries that do the exact same thing more than once? SELECT

Re: Another cry for help..

2007-12-20 Thread Anders Norrbring
Moon's Father skrev: Just a look at your sql query at first. Your like key word's right must like this: like 's%', then it'll use the index you created for your table. The second try you may use temporary table to replace your own query like (SELECT uid FROM users WHERE username = %s) Well,

Re: Another cry for help..

2007-12-20 Thread Anders Norrbring
Brent Baisley skrev: You might be able to use variables to store the result of the query. Although I've never tried assigning the result of a query to a variable, only field values. SELECT (count(*)+)/(SELECT COUNT(*) FROM score AS s2 WHERE s2.tid = @tid:=(SELECT tid FROM objects WHERE

Re: Another cry for help..

2007-12-20 Thread Anders Norrbring
Brent, you put me on the right track.. ;) Reading up a bit on syntax for variables, I came up with the following, which seems to work. SET @tid:=(SELECT tid FROM objects WHERE shortname = %s); SET @vid:=(SELECT vid FROM itemtypes WHERE itemtype LIKE %s); SELECT (count(*)+)/(SELECT COUNT(*)

Re: Another cry for help..

2007-12-20 Thread Anders Norrbring
Brent Baisley skrev: You're right that wouldn't work because you can't assign the query results to a variable. You want to put the variables in the query and assign them to the value of the field. ...WHERE s2.tid = (SELECT @tid:=tid AS tid FROM objects WHERE shortname = %s)... That should work

Re: Another cry for help..

2007-12-20 Thread Jay Pipes
You could use a view: CREATE VIEW all_scores SELECT s.tid, s.vid, s.uid, s.highScore FROM score s JOIN objects o ON s.tid = o.tid JOIN itemtypes it ON s.vid = it.vid JOIN users u ON s.uid = u.uid WHERE o.shortname = %s /* Should these ANDs really be ORs? */ AND i.itemtype LIKE %s; SELECT

Re: ODBC 3.51.22 problem - please help

2007-12-13 Thread Jim Winstead
On Wed, Dec 12, 2007 at 05:11:43PM -0800, Ed Reed wrote: I've found a glaring problem with the latest ODBC connector. Data types have been changed and data is no longer being read correctly. That's not quite correct -- data types are now actually being read correctly. They were wrong before,

ODBC 3.51.22 problem - please help

2007-12-12 Thread Ed Reed
that it always returns a VarChar Thanks for the help

Query help, please..

2007-12-11 Thread Anders Norrbring
I'm looking at a situation I haven't run into before, and I'm a bit puzzled by it. I have this table structure: Table USERS: userid, class Table OBJECT: userid, class, result Now I want to query the database for a certain user's result in a specified class, which is very, very easy. No

Re: Query help, please..

2007-12-11 Thread Rob Wultsch
On Dec 11, 2007 8:38 AM, Anders Norrbring [EMAIL PROTECTED] wrote: I'm looking at a situation I haven't run into before, and I'm a bit puzzled by it. I have this table structure: Table USERS: userid, class Table OBJECT: userid, class, result Now I want to query the database for a certain

Re: Query help, please..

2007-12-11 Thread Jason Pruim
On Dec 11, 2007, at 10:46 AM, Rob Wultsch wrote: On Dec 11, 2007 8:38 AM, Anders Norrbring [EMAIL PROTECTED] wrote: I'm looking at a situation I haven't run into before, and I'm a bit puzzled by it. I have this table structure: Table USERS: userid, class Table OBJECT: userid, class, result

Re: Query help, please..

2007-12-11 Thread Peter Brawley
Anders, I also want to find out the user's position relative to others depending on the result. For a given pUserID, something like this? SELECT userid,result,rank FROM ( SELECT o1.userid,o1.result,COUNT(o2.result) AS rank FROM object o1 JOIN object o2 ON o1.result o2.result OR

Need a *little* help with a procedure

2007-12-10 Thread Daniel Kasak
Greetings. I have 1 procedure that summarises data in a table for one particular location. It accepts the location ID, and returns the summary as a single record. It works well. Now I'm trying to write a procedure that selects all location IDs, and calls this 1st procedure for every single

HELP: How to duplicate rows...

2007-12-07 Thread rfeio
, but specifying field4 as abcd in all of them. How can I do this? Cheers! -- View this message in context: http://www.nabble.com/HELP%3A-How-to-duplicate-rows...-tf4962682.html#a14214522 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives

Re: HELP: How to duplicate rows...

2007-12-07 Thread mos
At 09:39 AM 12/7/2007, rfeio wrote: INSERT INTO table1 (field2, field3, field4) SELECT field2, field3, field4 WHERE field2=x Have you tried: INSERT INTO table1 (field2, field3, field4) SELECT field2, field3, ABCD WHERE field2=x Mike -- MySQL General Mailing List For list archives:

Re: HELP: How to duplicate rows...

2007-12-07 Thread Ananda Kumar
://www.nabble.com/HELP%3A-How-to-duplicate-rows...-tf4962682.html#a14214522 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: HELP: How to duplicate rows...

2007-12-07 Thread rfeio
before, but specifying field4 as abcd in all of them. How can I do this? Cheers! -- View this message in context: http://www.nabble.com/HELP%3A-How-to-duplicate-rows...-tf4962682.html#a14214522 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List

help with select

2007-12-05 Thread Hiep Nguyen
hi list, i have two tables: idea(iid int not null primary_key auto_increment, completed_by int, submitted_by int); employee(eid int not null primary_key auto_increment, first varchar(20), last varchar(30)); table idea data: 1 | 4 | 10 2 | 3 | 7 table employee data: 3 | john | Doe 4

Re: help with select

2007-12-05 Thread Andy Wallace
You might try this: SELECT I.iid, CONCAT(ECOMP.last, ', ', ECOMP.first) AS 'Completed By', CONCAT(ESUB.last, ', ', ESUB.first) AS 'Submitted By', FROM idea I JOIN employee ECOMP ON I.completed_by = ECOMP.eid JOIN employee ESUB ON I.submitted_by = ESUB.eid andy Hiep Nguyen

Re: help with select

2007-12-05 Thread Martin Gainty
PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, December 05, 2007 2:02 PM Subject: help with select hi list, i have two tables: idea(iid int not null primary_key auto_increment, completed_by int, submitted_by int); employee(eid int not null primary_key auto_increment, first varchar(20

<    4   5   6   7   8   9   10   11   12   13   >