Re: Having trouble with SQL query

2012-08-27 Thread rich gray
Hi Nitin Thanks - I tried that and got 0 rows... I have spent more time on describing my problem -- see below hopefully this will make the issue more clear... Rich I have a MySQL database with a menu table and a product table. - The products are linked to the menus in a one-to-many

Re: Having trouble with SQL query

2012-08-27 Thread Shawn Green
Hello Rich, On 8/27/2012 12:19 PM, rich gray wrote: Hi Nitin Thanks - I tried that and got 0 rows... I have spent more time on describing my problem -- see below hopefully this will make the issue more clear... Rich ... snip ... There are many resources out there that can tell you how to

Having trouble with SQL query

2012-08-26 Thread rich gray
I have a MySQL database with a menu table and a product table linked to the menus *(each product can be linked to more than menu row)* and the menus are nested. The query is that when a user clicks on a menu entry then all products linked to that entry *(there may be none)* will get displayed

Re: Having trouble with SQL query

2012-08-26 Thread Nitin Mehta
that works.     Regards,   From: rich gray r...@richgray.com To: mysql@lists.mysql.com Sent: Monday, August 27, 2012 2:46 AM Subject: Having trouble with SQL query I have a MySQL database with a menu table and a product table linked to the menus *(each product can

Re: SQL query help. Retrieve all DVDs that have at least one scene of a certain encoding format

2012-05-19 Thread Mark Kelly
Hi. On Friday 18 May 2012 18:21:07 Daevid Vincent wrote: Actually, I may have figured it out. Is there a better way to do this? I don't see why you need the dvds table when the dvd_id is in the scene table: SELECT a.dvd_id FROM scenes_list a, moviefiles b WHERE a.scene_id = b.scene_id AND

RE: SQL query help. Retrieve all DVDs that have at least one scene of a certain encoding format

2012-05-19 Thread Daevid Vincent
...@wastedtimes.net] Sent: Saturday, May 19, 2012 3:34 PM To: mysql@lists.mysql.com Subject: Re: SQL query help. Retrieve all DVDs that have at least one scene of a certain encoding format Hi. On Friday 18 May 2012 18:21:07 Daevid Vincent wrote: Actually, I may have figured it out. Is there a better

Re: SQL query help. Retrieve all DVDs that have at least one scene of a certain encoding format

2012-05-19 Thread Baron Schwartz
I would work from the inside out. What you're doing is grouping scenes by DVD and throwing away the ones that have no scenes. If you start with DVDs and do a subquery for each row, you'll process DVDs without scenes and then filter them out. If you start with a subquery that's grouped by DVD ID,

SQL query help. Retrieve all DVDs that have at least one scene of a certain encoding format

2012-05-18 Thread Daevid Vincent
I have a table of DVDs, another of scenes and a last one of encoding formats/files... I want to find in one query all the dvd_id that have 0 scene_id that's encoded in format_id = 13. In other words all DVDs that are format_id = 13 despite not having a direct link. CREATE TABLE `dvds` (

RE: SQL query help. Retrieve all DVDs that have at least one scene of a certain encoding format

2012-05-18 Thread Daevid Vincent
-Original Message- Sent: Friday, May 18, 2012 5:34 PM I have a table of DVDs, another of scenes and a last one of encoding formats/files... I want to find in one query all the dvd_id that have 0 scene_id that's encoded in format_id = 13. In other words all DVDs that are

Re: The most elegant/efficient way to pull this SQL query

2012-04-12 Thread Hal�sz S�ndor
2012/04/11 17:51 -0500, Peter Brawley select b.peopleID, concat('(',p.fname,,')'), b.stateID, concat('(',s.state,')') from bridge b join people p on b.peopleID=p.peopleID join state s on b.stateID=s.stateID; Since the names are the same in the tables, it works to use USING, too, and you are

Re: The most elegant/efficient way to pull this SQL query

2012-04-12 Thread Haluk Karamete
My initial goal was to write a very convenient php function that display a table view based on arguments that are super simple to write - without requiring the developer to type-in ( or know ) the ins and outs of joins, natural joins etc. Something like this function

Re: The most elegant/efficient way to pull this SQL query

2012-04-12 Thread Hal�sz S�ndor
; 2012/04/12 11:56 -0700, Haluk Karamete My initial goal was to write a very convenient php function that display a table view based on arguments that are super simple to write - without requiring the developer to type-in ( or know ) the ins and outs of joins, natural joins etc. Something

Re: The most elegant/efficient way to pull this SQL query

2012-04-11 Thread Peter Brawley
On 4/11/2012 1:30 PM, Haluk Karamete wrote: I've got this relational mySQL table that ties peopleIDs from the people table to the states IDs peopleID___stateID 1__1 2__4 3__5 people table is like this;

Re: The most elegant/efficient way to pull this SQL query

2012-04-11 Thread Hal�sz S�ndor
; 2012/04/11 11:30 -0700, Haluk Karamete I've got this relational mySQL table that ties peopleIDs from the people table to the states IDs peopleID___stateID 1__1 2__4 3__5 people table is like this; ___peopleID_FName_

Re: sql query advise

2011-06-24 Thread Johan De Meersman
Have a look at GROUP BY and aggregate functions: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html - Original Message - From: Norman Khine nor...@khine.net To: mysql@lists.mysql.com Sent: Thursday, 23 June, 2011 4:05:35 PM Subject: sql query advise hello, i have

sql query advise

2011-06-23 Thread Norman Khine
hello, i have this SQL code in a python programme but i wanted to change the SQL so that it returns totals for each date. or do i have to make a loop for each date range so that i get the following results which then i would like to plot on a graph. $ python daily_totals.py (2L,

Re: Complicated SQL Query

2010-08-26 Thread Jangita
On 26/08/2010 4:31 a, Jacob Steinberger wrote: I found an answer without having to worry about complicated SQL statements - it's more about managing the tables than the SQL. Jacob I usually just turn on binary logging, that way I have a record of anything that changes in the entire database

Re: Complicated SQL Query

2010-08-26 Thread Claudio Nanni
Inventions come from need. Congratulations and thank you for sharing your science, Its very interesting. May be useful for other uses. Claudio On Aug 26, 2010 9:11 AM, Jangita jang...@jangita.com wrote: On 26/08/2010 4:31 a, Jacob Steinberger wrote: I found an answer without having to worry

RE: Complicated SQL Query

2010-08-26 Thread Jerry Schwartz
-Original Message- From: Jacob Steinberger [mailto:trefal...@realitybytes.net] Sent: Wednesday, August 25, 2010 8:36 PM To: mysql@lists.mysql.com Subject: Complicated SQL Query I have a requirement to keep track of a set of data, and all changes that might occur. In order to do

RE: Complicated SQL Query

2010-08-26 Thread Jacob Steinberger
Quoting Jerry Schwartz je...@gii.co.jp: -Original Message- From: Jacob Steinberger [mailto:trefal...@realitybytes.net] I have a requirement to keep track of a set of data, and all changes that might occur. In order to do this, for each field of the data set, I've created a table that

Complicated SQL Query

2010-08-25 Thread Jacob Steinberger
I have a requirement to keep track of a set of data, and all changes that might occur. In order to do this, for each field of the data set, I've created a table that keeps track of the version, the value, the time the change was made, and a linking number that links all the different

Re: Complicated SQL Query

2010-08-25 Thread Jacob Steinberger
I found an answer without having to worry about complicated SQL statements - it's more about managing the tables than the SQL. Jacob Quoting Jacob Steinberger trefal...@realitybytes.net: I have a requirement to keep track of a set of data, and all changes that might occur. In order to do

RE: concatenate sql query with group by and having

2010-07-29 Thread Travis Ard
count(*) = 1; Date: Wed, 28 Jul 2010 11:10:32 -0500 Subject: concatenate sql query with group by and having From: pengyu...@gmail.com To: mysql@lists.mysql.com mysql -ugenome -hgenome-mysql.cse.ucsc.edu mm9 -A I start mysql with the above command. Then I

concatenate sql query with group by and having

2010-07-28 Thread Peng Yu
mysql -ugenome -hgenome-mysql.cse.ucsc.edu mm9 -A I start mysql with the above command. Then I want to select the rows from the result of the following query, provided that for any rows that have the same symbol, chrom and strand should be the same (basically, discard the rows that have the same

sql query advise

2010-04-23 Thread Norman Khine
hello, i have to write a query which has to pull data from a remote mysql server, modify the table scheme, format some of the fields and then populate the new database. i am using MySQLdb which is a python interface to mysql db. how would i write a query to do this update from from a single

Re: sql query advise

2010-04-23 Thread Norman Khine
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Fri, 23 Apr 2010 20:28:32 +0200 Subject: sql query advise From: nor...@khine.net To: mysql@lists.mysql.com hello, i have to write a query which has to pull data

SQL query for unique values.

2010-02-15 Thread Ravishankar BV .
16 Banana MH 17 Mango KA 18 Orange MP 19 Jackfruit AP 20 Apple TN From the above table, I want a SQL query which will list me the unique fruits and the states in which they are grown, like: Apple: KA, MH, TN Banana: TN, AP, MP, MH Jackfruit: MH,MP,AP Mango: MP, KA Orange: AP,MH

Re: SQL query for unique values.

2010-02-15 Thread Manasi Save
Banana TN 10 Apple MH 11 Jackfruit AP 12 Orange MH 13 Mango KA 14 Apple TN 15 Banana MP 16 Banana MH 17 Mango KA 18 Orange MP 19 Jackfruit AP 20 Apple TN From the above table, I want a SQL query which will list me the unique fruits and the states in which

Re: Force index command in sql query

2009-12-09 Thread Jesper Wisborg Krogh
On 09/12/2009, at 5:10 PM, Jeetendra Ranjan wrote: Hi, After analysing slow query log i found that some queries are not using index and so i used the force index command in query and test it and now it starts using index properly.Accordingly i implemented the same query with force index

Force index command in sql query

2009-12-08 Thread Jeetendra Ranjan
Hi, After analysing slow query log i found that some queries are not using index and so i used the force index command in query and test it and now it starts using index properly.Accordingly i implemented the same query with force index in my application code and regeneratet the slow query

sql query question that puzzles me

2009-11-25 Thread Lech Buszczynski
Hi, This thing puzzles me for quite some time and I wasn't successful in finding a clear answer anywhere - I would be grateful for some help. Here is a db example: table_1 id some_field_01 [...] some_field_20 table_2 itemid (table_1_id) value Let's say that the table_2 is used to store some

Basic SQL Query Help Needed

2009-08-25 Thread c...@hosting4days.com
I have a basic invoice table with related line items table Goal :I'd like to get ALL the related line items - for ALL the 'open' invoices... -- this should get a list of open (unpaid) invoices $query_invoice = SELECT DISTINCT ID from invoices where status = 'open' - --

RE: Basic SQL Query Help Needed

2009-08-25 Thread Martin Gainty
...@hosting4days.com Subject: Basic SQL Query Help Needed Date: Tue, 25 Aug 2009 16:21:45 -0700 I have a basic invoice table with related line items table Goal :I'd like to get ALL the related line items - for ALL the 'open' invoices... -- this should get a list of open (unpaid) invoices

REGEXP case insensitive SQL QUERY

2008-09-10 Thread Bala Balaravi
How can I use REGEXP case insensitive SQL QUERY Ex: select * from table where a REGEXP 'abc' will match both 'abc' and 'ABC'

Create Table from Results of SQL Query

2008-07-03 Thread O. Olson
Hi, I have a SQL Query that has an inner join and it is taking too long to execute. I am thinking of speeding this up by dumping the result into a separate table – as I would be requiring the result of this query many times in the future. I am wondering if someone could show

Re: Create Table from Results of SQL Query

2008-07-03 Thread Dan Nelson
In the last episode (Jul 04), O. Olson said: I have a SQL Query that has an inner join and it is taking too long to execute. I am thinking of speeding this up by dumping the result into a separate table - as I would be requiring the result of this query many times in the future. I am

Re: Create Table from Results of SQL Query

2008-07-03 Thread O. Olson
Thanks Dan for your quick response - it works now. I am new to SQL in general and MySQL in particular. O.O. --- Ven 4/7/08, Dan Nelson [EMAIL PROTECTED] ha scritto: Da: Dan Nelson [EMAIL PROTECTED] Oggetto: Re: Create Table from Results of SQL Query A: O. Olson [EMAIL PROTECTED] Cc

Re: A SQL Query Question

2008-04-18 Thread Peter Brawley
userId long picture MeduimBlob datePosted DateTime A userId can have many pictures posted. I want to write a query that returns a distinct userId along with the most recent picture posted. Can someone suggest an elegant and fast query to accomplish this? Latest pic for user N: SELECT

A SQL Query Question

2008-04-17 Thread samk
See Thread at: http://www.techienuggets.com/Detail?tx=32975 Posted on behalf of a User Hello everyone, I have a table A: userId long picture MeduimBlob datePosted DateTime A userId can have many pictures posted. I want to write a query that returns a distinct userId along with the most

Re: A SQL Query Question

2008-04-17 Thread samk
See Thread at: http://www.techienuggets.com/Detail?tx=32975 Posted on behalf of a User select userId, picture, MAX(datePosted) from A order by datePosted; In Response To: Hello everyone, I have a table A: userId long picture MeduimBlob datePosted DateTime A userId can have many

Re: SQL query question for GROUP BY

2008-04-15 Thread Victor Danilchenko
I just thought of something else... could the same be accomplished using stored routines? I could find no way in MySQL to create stored routines which could be used with the 'group by' queries though. If this were possible, it should then be also possible to define a 'LAST' stored routine,

Re: SQL query question for GROUP BY

2008-04-15 Thread Perrin Harkins
On Fri, Apr 11, 2008 at 4:01 PM, Victor Danilchenko [EMAIL PROTECTED] wrote: Oooh, this looks evil. It seems like such a simple thing. I guess creating max(log_date) as a field, and then joining on it, is a solution -- but my actual query (not the abridged version) is already half a

SQL query question for GROUP BY

2008-04-11 Thread Victor Danilchenko
Hi all, I trying to run a query where, after doing a UNION on two different SELECTs, I need to sort the result by username and log_date fields, and then grab the last entry for each username ('last' as determined by the ordering of the log_date field, which is a datetime). GROUP

Re: SQL query question for GROUP BY

2008-04-11 Thread Rob Wultsch
On Fri, Apr 11, 2008 at 11:46 AM, Victor Danilchenko [EMAIL PROTECTED] wrote: GROUP BY seems like an obvious choice; 'GROUP BY username', to be exact. However, this seems to produce not the last row's values, but ones from a random row in the group. Under most databases your query is

Re: SQL query question for GROUP BY

2008-04-11 Thread Victor Danilchenko
Oooh, this looks evil. It seems like such a simple thing. I guess creating max(log_date) as a field, and then joining on it, is a solution -- but my actual query (not the abridged version) is already half a page long. I think at this point, unless someone else suggests a better solution,

Re: SQL query question for GROUP BY

2008-04-11 Thread Rob Wultsch
On Fri, Apr 11, 2008 at 1:01 PM, Victor Danilchenko [EMAIL PROTECTED] wrote: Oooh, this looks evil. It seems like such a simple thing. I guess creating max(log_date) as a field, and then joining on it, is a solution -- but my actual query (not the abridged version) is already half a

Help with SQL query construction

2007-12-03 Thread Marcus Claesson
Hi! I have a SQL query construction question that I hope someone can help me with. After comparing a bunch of DNA fragments (see name below) with a larger reference sequence I get a ordered list ranked according to similarities, and with start/stop co-ordinates where the fragments map

RE: Help with SQL query construction

2007-12-03 Thread Jeff Mckeon
-Original Message- From: Marcus Claesson [mailto:[EMAIL PROTECTED] Sent: Monday, December 03, 2007 7:49 AM To: mysql@lists.mysql.com Subject: Help with SQL query construction Hi! I have a SQL query construction question that I hope someone can help me with. After comparing

Re: Help with SQL query construction

2007-12-03 Thread Peter Brawley
Marcus, I've managed to do this with a Perl-DBI script, but would much prefer to do it completely with MySQL instead. You could port it to a recursive stored procedure. It would probably be slower, and what would you have gained? PB Marcus Claesson wrote: Hi! I have a SQL query

SQL query problem

2007-11-14 Thread Matthew Stuart
Hi, I have built a site with Dreamweaver and I have a problem with a query. I am trying to pass a parameter from one page to another to drill down. Basically, I have one product entry that is in multiple categories on my website. So, say it's a dress, it is therefore related to category

Re: SQL query problem

2007-11-14 Thread Ravi Kumar.
Dear Mat, Your mail is not very clear. But I have a feeling that using '%' wildcard in the like operand should help you Regards, Ravi. On 11/14/07, Matthew Stuart [EMAIL PROTECTED] wrote: Hi, I have built a site with Dreamweaver and I have a problem with a query. I am trying to pass a

Need help with a sql query

2007-10-21 Thread Imran
Hello all: I have two tables: 1. MenuAccess: accessId fkMenuId fkGroupid View Execute 2. MenuOptions MenuId MenuName I would like to get all of the records in MenuOptions and any record in MenuAccess with a specific fkGroupid. For example: A. MenuAccess

Re: Need help with a sql query

2007-10-21 Thread mysql
Imran wrote: Hello all: ... I would like to get all of the records in MenuOptions and any record in MenuAccess with a specific fkGroupid. For example: ... IIf I run a query for fkgroupid = 1 I should get AccessId fkMenuID fkgroupid view execute

How to rewrite SQL query for new MySQL LEFT JOINS

2007-05-23 Thread Gmail User
I hope someone can clue me in what a syntax of query that produces the same would look like for MySQL 5.0.12 Old query meant to list most recent message from each thread, e.g. select * from messages left join messages as messages_ on messages.thread = messages_.thread and messages.created

Re: How to rewrite SQL query for new MySQL LEFT JOINS

2007-05-23 Thread Gmail User
It worked in 4.x but does not work in the new syntax. How should I rewrite it to get the same result? OK, that was a lie. It works in 5.x as well. I should learn to describe my problem more accurately as well as RTFM :-( The correct description of the query in question would have been: select

Re: Interesting SQL Query - Total and Grouped Counts together?

2007-04-30 Thread Imran Chaudhry
Baron, Thanks very much for that simple but very effective solution. I altered your SQL slightly, the final SQL looks like this: SELECT domain, count(*) AS 'count all', SUM(IF(mime = 'text/html', 1, 0)) AS 'count text', SUM(IF(mime LIKE 'image/%', 1, 0)) AS 'count image' FROM tableA

monitoring SQL query response times

2007-04-28 Thread Masao Kitamura
Is there a way to monitor SQL query response times? Here's my current my.cnf relating to logs, but I only see response times in the slow query log, and even then, the response time is rounded to the nearest second. log=/logs/mysql.log log-error=/logs/mysql-error.log log-slow-queries=/logs/mysql

Re: monitoring SQL query response times

2007-04-28 Thread Thomas van Gulick
Is there a way to monitor SQL query response times? Mysqlperformanceblog has patches for higher granularity query log: http://www.mysqlperformanceblog.com/2006/09/06/slow-query-log-analyzes-tools/ You could always just wrap the query calls in between some time registration of your own

Interesting SQL Query - Total and Grouped Counts together?

2007-04-26 Thread Imran Chaudhry
I'm wondering if any of you can assist with an interesing SQL query. I have a single table within a database, the relevant fields of which are defined as: CREATE TABLE tableA ( domain text, mime text ); Where domain is a domain

Re: Interesting SQL Query - Total and Grouped Counts together?

2007-04-26 Thread Baron Schwartz
Hi, Imran Chaudhry wrote: I'm wondering if any of you can assist with an interesing SQL query. I have a single table within a database, the relevant fields of which are defined as: CREATE TABLE tableA ( domain text, mime text ); Where

Re: Interesting SQL Query - Total and Grouped Counts together?

2007-04-26 Thread Mogens Melander
On Thu, April 26, 2007 18:38, Baron Schwartz wrote: Hi, Imran Chaudhry wrote: I'm wondering if any of you can assist with an interesing SQL query. I have a single table within a database, the relevant fields of Try IF or CASE expressions: SELECT foo, count(*), sum(case when foo = 'bar

Re: mysql sql query size limit

2007-04-10 Thread Michael Dykman
The closest thing to an absolute limit on query size is the value of the configuration variable max_allowed_packet which defaults to 1 meg. - michael On 4/10/07, Anil D [EMAIL PROTECTED] wrote: Hi List, What is the practical limit on size of the sql query in mysql 4.1.x Anil

mysql sql query size limit

2007-04-09 Thread Anil D
Hi List, What is the practical limit on size of the sql query in mysql 4.1.x Anil

SQL Query Question

2007-01-21 Thread Adam Bishop
If I have a dataset as below: Name, Age, Word Bob, 13, bill Joe, 13, oxo Alex, 14, thing Jim, 14, blob Phil, 14, whatsit Ben, 15, doodah Rodney, 15, thingy I want to select the first block where the age is equal, i.e. return in the case of the above

Re: SQL Query Question

2007-01-21 Thread Dan Nelson
In the last episode (Jan 22), Adam Bishop said: If I have a dataset as below: Name, Age, Word Bob, 13, bill Joe, 13, oxo Alex, 14, thing Jim, 14, blob Phil, 14, whatsit Ben, 15, doodah Rodney, 15, thingy I want to select the first block where the age is

RE: SQL Query Question

2007-01-21 Thread Adam Bishop
Ah, that would work. Looks like I was making the problem too complex in my mind, thanks for your help. Adam Bishop -Original Message- From: Dan Nelson [mailto:[EMAIL PROTECTED] Sent: 22 January 2007 07:07 To: Adam Bishop Cc: mysql@lists.mysql.com Subject: Re: SQL Query Question

sql query

2006-10-17 Thread Peter
Hello, Lets suppose I have a table like this one id id_1 id_2 date_time 1 101 1000 2006-07-04 11:25:43 2 102 1001 2006-07-04 11:26:43 3 101 1005 2006-07-04 11:27:43 4 103 1000 2006-07-04 11:25:43 I want to find all id_2 that has same id_1 and time difference in records is no more than 5 minutes

Re: sql query

2006-10-17 Thread Dan Buettner
Hi Peter - Something like this ought to work: SELECT t1.id_2 FROM mytable t1, mytable t2 WHERE t1.id_1 = t2.id_1 AND t1.id != t2.id AND ABS( UNIX_TIMESTAMP(t1.date_time) - UNIX_TIMESTAMP(t2.date_time) ) = 300 Dan On 10/17/06, Peter [EMAIL PROTECTED] wrote: Hello, Lets suppose I have a table

Re: sql query

2006-10-17 Thread Peter Brawley
I want to find all id_2 that has same id_1 and time difference in records is no more than 5 minutes ... How about ... SELECT id_2 FROM tbl AS t1 JOIN tbl AS t2 ON t1.id_2 = t2.id_1 WHERE ABS(SEC_TO_TIME(t1.date_time)-SEC_TO_TIME(t2.date_time))=300; PB - Peter wrote: Hello, Lets

Re: sql query

2006-10-17 Thread Rolando Edwards
Sent: Tuesday, October 17, 2006 2:55:37 PM GMT-0500 US/Eastern Subject: Re: sql query Hi Peter - Something like this ought to work: SELECT t1.id_2 FROM mytable t1, mytable t2 WHERE t1.id_1 = t2.id_1 AND t1.id != t2.id AND ABS( UNIX_TIMESTAMP(t1.date_time) - UNIX_TIMESTAMP(t2.date_time) ) = 300 Dan

Re: sql query

2006-10-17 Thread Peter
Rolando Edwards wrote: Dan's is correct because Thank you ALL for your kind help !!! Send instant messages to your online friends http://uk.messenger.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL

SQL Query help

2006-10-08 Thread C K
Friends, I am developing a database for accounting software. I have one problem regarding calculation of balances on daily basis for all ledgers. I am using Access 2003 as frontend. While designing I found that maintaining of daily balances is impossible to client's requirements. But as the

The length of the sql query

2006-08-23 Thread Emi Lu
Hello, Just curious to know whether Mysql 3.23 has any length constraint about where part, such as Query = [ select col1, col2, ... coln from table 1, table2, where constraint1 + constraint2 +constraintN ] Is there any length arrange for the Query str such

Re: The length of the sql query

2006-08-23 Thread Michael Loftis
--On August 23, 2006 1:55:36 PM -0400 Emi Lu [EMAIL PROTECTED] wrote: Hello, Just curious to know whether Mysql 3.23 has any length constraint about where part, such as Query = [ select col1, col2, ... coln from table 1, table2, where constraint1 + constraint2

Re: The length of the sql query

2006-08-23 Thread Dan Buettner
Emi, it appears in 3.23 your limit is 16 MB. In 4.0 and later, it is 1 GB. http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html Dan On 8/23/06, Emi Lu [EMAIL PROTECTED] wrote: Hello, Just curious to know whether Mysql 3.23 has any length constraint about where part, such as

How can I use a value computed in my SQL query for further computations?

2006-04-17 Thread Daevid Vincent
Here is a paired down version of a query I want to make. How can I get the grandtotal column? I know about the HAVING clause, but that's only going to be good for weeding out rows I don't want. I just want to do some basic math here. SELECT a.*, DATE_FORMAT(a.created_on,'%m/%d/%y

RE: How can I use a value computed in my SQL query for further computations?

2006-04-17 Thread Daevid Vincent
to use PHP to do basic math on the table when mySQL can do it probably faster. -Original Message- From: Daevid Vincent [mailto:[EMAIL PROTECTED] Sent: Monday, April 17, 2006 7:33 PM To: mysql@lists.mysql.com Subject: How can I use a value computed in my SQL query for further

RE: How can I use a value computed in my SQL query for further computations?

2006-04-17 Thread Jay Blanchard
[snip] Here is a paired down version of a query I want to make. How can I get the grandtotal column? I know about the HAVING clause, but that's only going to be good for weeding out rows I don't want. I just want to do some basic math here. SELECT a.*, DATE_FORMAT(a.created_on,'%m/%d/%y

RE: How can I use a value computed in my SQL query for further computations?

2006-04-17 Thread Jay Blanchard
[snip] Here is a paired down version of a query I want to make. How can I get the grandtotal column? I know about the HAVING clause, but that's only going to be good for weeding out rows I don't want. I just want to do some basic math here. [/snip] More

RE: How can I use a value computed in my SQL query for further computations? [solved]

2006-04-17 Thread Daevid Vincent
, April 17, 2006 7:42 PM To: mysql@lists.mysql.com Subject: RE: How can I use a value computed in my SQL query for further computations? To add to this, I will also want to be able to ORDER BY those three new columns (totalviews, totalclicks, grandtotal) as well.. I'm using mySQL 5 and innodb

Can I do a boolean search and get the row count in 1 SQL query?

2006-01-02 Thread Grant Giddens
Hi, I have a web app where I am doing a boolean search. I only want to return 10 results per page, but I'd also like to know how many total rows match the search query. I'm currently performing this with 2 query statements: 1. (To get the actual rows via the search)

Re: Can I do a boolean search and get the row count in 1 SQL query?

2006-01-02 Thread Octavian Rasnita
Hi, You can do: select sql_calc_found_rows [and here follow the rest of the select query]; And then you can get the number of all found rows, not only those got by limit 10 as follows: select found_rows(); Teddy From: Grant Giddens [EMAIL PROTECTED] Hi, I have a web app where I am

Can I go a boolean search and get the row count in 1 SQL query?

2005-12-30 Thread Grant Giddens
Hi, I have a web app where I am doing a boolean search. I only want to return 10 results per page, but I'd also like to know how many total rows match the search query. I'm currently performing this with 2 query statements: 1. (To get the actual rows via the search) SELECT

Can this SQL query be done with MySql?

2005-11-14 Thread WARVIN BARKER
Hi! I have a MySQL table with perid (person id), CaseId (the latter two fields are varchar). The persons (perid) can be on more than one case. They can get married and change caseids, or they can come of age and get their own caseid. So a given perid can be associated with multiple

Re: Can this SQL query be done with MySql?

2005-11-14 Thread Rhino
See remarks interspersed below Rhino - Original Message - From: WARVIN BARKER [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Monday, November 14, 2005 10:44 AM Subject: Can this SQL query be done with MySql? Hi! I have a MySQL table with perid (person id), CaseId (the latter

Re: Help with an SQL query

2005-11-06 Thread Gobi
Rhino wrote: I'm glad the explanation helped. I figured that the solution alone wouldn't be very useful if it wasn't explained since it is not obvious to most people how correlated queries work :-) I really wasn't trying to center you out with my rant about MySQL version. It's been a

Re: Help with an SQL query

2005-11-05 Thread Gobi
Rhino wrote: I can't test this in MySQL- I'm using an older version of MySQL that doesn't support subqueries - but it works in DB2 and it should do the trick for getting the current weight of each VBS_id value: select VBS_id, date, weight from VBS_table x where date = (select max(date) from

Re: Help with an SQL query

2005-11-05 Thread Rhino
@lists.mysql.com Sent: Saturday, November 05, 2005 8:05 AM Subject: Re: Help with an SQL query Rhino wrote: I can't test this in MySQL- I'm using an older version of MySQL that doesn't support subqueries - but it works in DB2 and it should do the trick for getting the current weight of each VBS_id value

Help with an SQL query

2005-11-04 Thread Gobi
Not sure if this is the right place to ask. I have a table, Weight, with the following test data: idx VBS_ID DateWeight 11110/3/200511.5 2119/5/2004 10 31110/7/200511.51 41110/8/200511.52 51210/8/2005

Re: Help with an SQL query

2005-11-04 Thread Arno Coetzee
Gobi wrote: Not sure if this is the right place to ask. I have a table, Weight, with the following test data: idx VBS_ID DateWeight 11110/3/200511.5 2119/5/2004 10 31110/7/200511.51 41110/8/200511.52 512

Re: Help with an SQL query

2005-11-04 Thread Gobi
Arno Coetzee wrote: Gobi wrote: Not sure if this is the right place to ask. I have a table, Weight, with the following test data: idx VBS_ID DateWeight 11110/3/200511.5 2119/5/2004 10 31110/7/200511.51 41110/8/2005

Re: Help with an SQL query

2005-11-04 Thread Gobi
Gobi wrote: Arno Coetzee wrote: Gobi wrote: Not sure if this is the right place to ask. I have a table, Weight, with the following test data: idx VBS_ID DateWeight 11110/3/200511.5 2119/5/2004 10 31110/7/200511.51 4

Re: Help with an SQL query

2005-11-04 Thread Johan Höök
Hi Gobi, there was a similar posting in august. See: http://lists.mysql.com/mysql/187436 which I think describes what you want. I'll include a bit of it here as well -- This is out of the MySQL class and is called the Max-Concat trick.

Re: Help with an SQL query

2005-11-04 Thread Gobi
Johan Höök wrote: Hi Gobi, there was a similar posting in august. See: http://lists.mysql.com/mysql/187436 which I think describes what you want. I'll include a bit of it here as well -- This is out of the MySQL class and is called the Max-Concat trick.

Re: Help with an SQL query

2005-11-04 Thread Gobi
Johan Höök wrote: Hi Gobi, there was a similar posting in august. See: http://lists.mysql.com/mysql/187436 which I think describes what you want. I'll include a bit of it here as well -- This is out of the MySQL class and is called the Max-Concat trick.

Re: Help with an SQL query

2005-11-04 Thread Johan Höök
Hi Gobi, the problem with your original query is that there is no guarantee that your max(date) and it's associated VBS_ID is picked, so what you have to ensure is that they get picked together, so I think your statement should be like this: SELECT VBS_ID, SUBSTRING( MAX( CONCAT( LPAD(

Re: Help with an SQL query

2005-11-04 Thread Gobi
Figured out the query: select idx, vbs_id, date, weight from Weight, (select vbs_id as maxid, max(date) as maxdate from Weight group by vbs_id) as t where vbs_id = maxid and date = maxdate; It returns the proper weight and idx. -- MySQL General Mailing List For list archives:

Fw: Help with an SQL query

2005-11-04 Thread Rhino
Oops, I meant to post this on the list AND copy the person asking the question Rhino - Original Message - From: Rhino [EMAIL PROTECTED] To: Gobi [EMAIL PROTECTED] Sent: Friday, November 04, 2005 1:46 PM Subject: Re: Help with an SQL query I can't test this in MySQL- I'm using

SQL query taking a long time

2005-08-02 Thread Kapoor, Nishikant
Following query is taking a long time (upto 10 secs) to return the resultset. Would greatly appreciate if someone could help me understand why. I have run 'analyze table tablename' on all the three tables involved. The EXPLAIN output, record count and table description is also included. SELECT

RE: SQL query taking a long time...please

2005-08-02 Thread Kapoor, Nishikant
Just wondering if someone would be kind enough to take a look at it - Nishi -Original Message- Following query is taking a long time (upto 10 secs) to return the resultset. Would greatly appreciate if someone could help me understand why. I have run 'analyze table tablename' on

  1   2   3   4   5   >