Re: how to query this

2009-09-10 Thread Claudio Nanni
This can also help: select id,value from table order by value desc limit 1; Cheers Claudio 2009/9/10 Slackli User > Thanks all the info. > Just got what I wanted. > > 2009/9/10 Wolfgang Schaefer : > > John Daisley schrieb: > >> SELECT MAX(value), id FROM table > >> GROUP BY id; > >> > >> >

Re: how to query this

2009-09-10 Thread Slackli User
Thanks all the info. Just got what I wanted. 2009/9/10 Wolfgang Schaefer : > John Daisley schrieb: >> SELECT MAX(value), id FROM table >> GROUP BY id; >> >> >> > > I guess what Slackli had in mind was more something like this: > SELECT id, value > FROM table > WHERE value = (SELECT max(value) FROM

Re: how to query this

2009-09-10 Thread Wolfgang Schaefer
John Daisley schrieb: > SELECT MAX(value), id FROM table > GROUP BY id; > > Regards > > John Daisley > Mobile +44(0)7812 451238 > Email j...@butterflysystems.co.uk > > Certified MySQL 5 Database Administrator (CMDBA) > Certified MySQL 5 Developer > Cognos BI Developer > > --- >

RE: how to query this

2009-09-10 Thread John Daisley
. -Original Message- From: Slackli User Sent: Thursday, September 10, 2009 10:43 AM To: mysql@lists.mysql.com Subject: how to query this Hello, sorry I'm not good at SQL statement. I have a table, whose stru is like: idvalue 1 33 2 987 3 10 4 22 ... I

how to query this

2009-09-10 Thread Slackli User
Hello, sorry I'm not good at SQL statement. I have a table, whose stru is like: idvalue 1 33 2 987 3 10 4 22 ... I want to get the max value and the corresponding id, using this sql: select max(value),id from table; but it won't work. so what's the

HOW TO QUERY(SELECT) and display MULTIPLE AUTHORS

2009-02-22 Thread PJ
"SELECT b.title, b.sub_title, b.descr, b.comment, b.bk_cover, b.copyright, b.ISBN, c.publisher, CONCAT_WS(' ', first_name, last_name) AS Author FROM book AS b LEFT JOIN book_author AS ab ON b.id = ab.bookID LEFT JOIN author AS a ON ab.authID=a.id LEFT JOIN book_publisher AS abc ON b.id = abc.book

Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread gary
the thing to remember is that if you only want strings that start with CAT you'd never want to query with %CAT% because this could match DOG_CATHY. % is a wildcard that matches any number of characters including none. if you want to match a single character you use _ if you actually need to s

Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread David T. Ashley
On 7/4/07, Dan Nelson <[EMAIL PROTECTED]> wrote: In the last episode (Jul 04), David T. Ashley said: > On 7/4/07, gary <[EMAIL PROTECTED]> wrote: > > SELECT column FROM table WHERE column LIKE "CAT\_%"; > > Would it be reasonable to assume that if "column" is indexed, the > query would execut

Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread Dan Nelson
In the last episode (Jul 04), David T. Ashley said: > On 7/4/07, gary <[EMAIL PROTECTED]> wrote: > > SELECT column FROM table WHERE column LIKE "CAT\_%"; > > Would it be reasonable to assume that if "column" is indexed, the > query would execute quickly, i.e. I would assume that the indexing >

Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread David T. Ashley
On 7/4/07, gary <[EMAIL PROTECTED]> wrote: SELECT column FROM table WHERE column LIKE "CAT\_%"; Would it be reasonable to assume that if "column" is indexed, the query would execute quickly, i.e. I would assume that the indexing would facilitate this kind of query?

Re: How to Query by First Part of a VARCHAR?

2007-07-04 Thread gary
SELECT column FROM table WHERE column LIKE "CAT\_%"; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

How to Query by First Part of a VARCHAR?

2007-07-04 Thread David T. Ashley
If I have a table with rows like this, all varchar: DOG_LUCY DOG_CHARLIE DOG_LASSIE DOG_XRAY CAT_MR_BIGGLESWORTH CAT_SCRATCHER CAT_WHISTLER what is the form of a query that will return the rows where the first part of the string matches? For example, what if I'd like to return the rows that beg

Re: how to query this sql?

2007-04-28 Thread Mogens Melander
On Sun, April 29, 2007 05:28, Jeff Pang wrote: > Hello list, > > I want to get the counter for db-items by each day,so I wrote this sql: > > select count(*) as dd from items group by updatetime; > > But sorry "updatetime" is "datetime" type,not "date" type.Then I can't get > the correct result. >

how to query this sql?

2007-04-28 Thread Jeff Pang
Hello list, I want to get the counter for db-items by each day,so I wrote this sql: select count(*) as dd from items group by updatetime; But sorry "updatetime" is "datetime" type,not "date" type.Then I can't get the correct result. How can I do this?Thanks. 50€ AMAZON-Einkaufsgutschein bei

Re: Re: How to query bind address?

2006-08-23 Thread James Eaton
; Cc: Sent: Wednesday, August 23, 2006 3:07 PM Subject: Re: Re: How to query bind address? Is it running on Windows, James? You may have to allow connections through to MySQL in Windows Firewall. Otherwise it seems like maybe it's been started with --skip-networking ? Dan On 8/23/06, Ja

Re: Re: How to query bind address?

2006-08-23 Thread Dan Buettner
Is it running on Windows, James? You may have to allow connections through to MySQL in Windows Firewall. Otherwise it seems like maybe it's been started with --skip-networking ? Dan On 8/23/06, James Eaton <[EMAIL PROTECTED]> wrote: - Original Message - From: "Dan Buettner" <[EMAIL P

Re: How to query bind address?

2006-08-23 Thread James Eaton
- Original Message - From: "Dan Buettner" <[EMAIL PROTECTED]> I believe MySQL listens on all IPs ... what if any error message are you getting? From SQLyog I get: Error No. 2003 Can't connect to MySQL server on '192.168.9.2' (10061) Can you access other services (SSH, telnet,

Re: How to query bind address?

2006-08-23 Thread Dan Buettner
I believe MySQL listens on all IPs ... what if any error message are you getting? Can you access other services (SSH, telnet, FTP) over the same routes? Can you telnet to MySQL over those routes? If so you may have an authentication problem, not a connection problem. Here's a sample of what a

How to query bind address?

2006-08-23 Thread James Eaton
Is there a way to query a MySQL (5.0.xx) server to find out which IP address(es) it's listening on? It should be listening on all, but I'm unable to connect from remote machines, so need to troubleshoot a bit. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To u

Re: How to query on part of a date column?

2006-07-20 Thread mos
At 06:20 PM 7/20/2006, Martin Jespersen wrote: As long as backticks are used around fieldnames, spaces and/or reserved words are fine, tho it does tend to create more work for the user ;) Correct. But how many people want to create more work for themselves? A show of hands please! Mike mo

Re: How to query on part of a date column?

2006-07-20 Thread Martin Jespersen
As long as backticks are used around fieldnames, spaces and/or reserved words are fine, tho it does tend to create more work for the user ;) mos wrote: At 12:02 PM 7/20/2006, you wrote: I've got a table of people who registered for a convention. Each person has a registration date, kept in a

Re: How to query on part of a date column?

2006-07-20 Thread mos
At 12:02 PM 7/20/2006, you wrote: I've got a table of people who registered for a convention. Each person has a registration date, kept in a standard date field. How do I select for people who registered in a particular month or year? The obvious tests like: Select * from Capclave2005reg W

Re: How to query on part of a date column?

2006-07-20 Thread Dan Buettner
Barry, I think you've got too many quotes in your SQL - the db is trying to find the year from the string 'date paid'. You want to use it as a column name, so drop the quotes: Select * from Capclave2005reg Where Year(Date Paid) = 2004; If you've really got a space in your column name, try enclo

How to query on part of a date column?

2006-07-20 Thread Barry Newton
I've got a table of people who registered for a convention. Each person has a registration date, kept in a standard date field. How do I select for people who registered in a particular month or year? The obvious tests like: Select * from Capclave2005reg Where Year('Date Paid') = 2004; ret

"high priority" messages (Re: How to query an oracle table from a mysql database)

2004-07-07 Thread Martijn Tonies
Hi all, Please, do NOT send messages to a public mailinglist as "high priority" by flagging the email itself. You're sending this message to hundreds/thousands of people. It might be "important" to you, but not for each recipient. If someone has filters/triggers for "important" email, he will get

RE: How to query an oracle table from a mysql database

2004-07-07 Thread Alonso, Claudio Fabian
e 2004 15:46 Para: 'Alonso, Claudio Fabian '; ''Steve Davies' ' CC: '''[EMAIL PROTECTED]' ' ' Asunto: RE: How to query an oracle table from a mysql database A custom MySQL UDF is one solution if you are comfortable with C. Off list questi

RE: How to query an oracle table from a mysql database

2004-07-07 Thread Victor Pendleton
Sent: 7/7/04 11:18 AM Subject: RE: How to query an oracle table from a mysql database Importance: High Hello Steve, hello Victor, Thanks for your answers. My PHP application needs to see this Oracle table, but as far as I could see PHP has problems with Oracle 9.2.0. I got a conection problem and f

RE: How to query an oracle table from a mysql database

2004-07-07 Thread Paul DuBois
At 13:18 -0300 7/7/04, Alonso, Claudio Fabian wrote: Hello Steve, hello Victor, Thanks for your answers. My PHP application needs to see this Oracle table, but as far as I could see PHP has problems with Oracle 9.2.0. I got a conection problem and found in the PHP's bug database that it isn't curre

RE: How to query an oracle table from a mysql database

2004-07-07 Thread Justin Swanhart
No, that isn't possible using mySQL. Try linking PHP with older client libraries (9.0.1, 8.1.5, etc) instead of the newer 9.2 libraries and see if that fixes your problem with PHP. You can download them from otn.oracle.com swany --- "Alonso, Claudio Fabian" <[EMAIL PROTECTED]> wrote: > Hello S

RE: How to query an oracle table from a mysql database

2004-07-07 Thread Alonso, Claudio Fabian
Hello Steve, hello Victor, Thanks for your answers. My PHP application needs to see this Oracle table, but as far as I could see PHP has problems with Oracle 9.2.0. I got a conection problem and found in the PHP's bug database that it isn't currently working. As I'm familiar with PHP/MySQL, I'm try

Re: How to query an oracle table from a mysql database

2004-07-07 Thread Martin Gainty
abian '" <[EMAIL PROTECTED]> CC: "''[EMAIL PROTECTED]' '" <[EMAIL PROTECTED]> Subject: Re: How to query an oracle table from a mysql database Date: Wed, 07 Jul 2004 17:02:59 +0100 MIME-Version: 1.0 Received: from lists.mysql.com ([213.136.52.31]) b

Re: How to query an oracle table from a mysql database

2004-07-07 Thread Steve Davies
nt: 7/7/04 8:14 AM Subject: How to query an oracle table from a mysql database Importance: High Good morning, I need a MySQL database to be able to query a table in an Oracle database of a remote host. Is this possible? Could anybody tell me how to do it or where to find this information? Thanks

RE: How to query an oracle table from a mysql database

2004-07-07 Thread Victor Pendleton
You may want to look into using a programming language such as C or Java that communicates between both databases. -Original Message- From: Alonso, Claudio Fabian To: '[EMAIL PROTECTED]' Sent: 7/7/04 8:14 AM Subject: How to query an oracle table from a mysql database Import

How to query an oracle table from a mysql database

2004-07-07 Thread Alonso, Claudio Fabian
Good morning, I need a MySQL database to be able to query a table in an Oracle database of a remote host. Is this possible? Could anybody tell me how to do it or where to find this information? Thanks in advance, --Claudio ..

Re: How to query

2003-12-04 Thread Randy Chrismon
I'm stumped... Now, I need to generate reports for a specific client. In the end, for a given month, I have to tell the client 1. Which invoices were for the purchase of blue widgets, only. 2. Which invoices were for the purchase of blue widgets and yellow widgets, together. 3. Which invoices for

How to query

2003-12-04 Thread Randy Chrismon
I'm stumped... I have a pretty standard invoice system: create table invoice( InvoiceNum varhcar(16), ClientInfo ) create table line_items( InvoiceNum varchar(16), ProductCode varchar(10), Description varchar(25), Quantity . ) Three is, of course, a one-to-many relation betwe

Re: How to query mySQL in java without using actual column names? but using something like field(0),field(1) etc.,

2003-11-08 Thread Paul DuBois
At 10:38 -0500 11/8/03, karthikeyan wrote: I have a table with about 100 column with different column name. It is difficult to remember all the field names. But I know the last few columns are very important for query and used frequently. You cannot perform comparisons on columns by using column po

How to query mySQL in java without using actual column names? but using something like field(0),field(1) etc.,

2003-11-08 Thread karthikeyan
I have a table with about 100 column with different column name. It is difficult to remember all the field names. But I know the last few columns are very important for query and used frequently. For example: Table with fields weight_42(double),width_43(double),height_44(double) where the fields(4

Re: How to query for 25 records before and 25 records after a record alphabetically

2003-11-03 Thread gerald_clark
ORDER BY and LIMIT. Jeremy March wrote: I have an alphabetic list of records in a table and I want to display the 25 previous and 25 next records before and after a selected record. This would be easy if "before" and "after" meant sorted by id number, but I need it sorted alphabetically. Doe

How to query for 25 records before and 25 records after a record alphabetically

2003-11-03 Thread Jeremy March
I have an alphabetic list of records in a table and I want to display the 25 previous and 25 next records before and after a selected record. This would be easy if "before" and "after" meant sorted by id number, but I need it sorted alphabetically. Does anyone know a good way to do this? Than

Re: Re: How to query an entire row?

2003-02-24 Thread Jeff Snoxell
At 13:53 24/02/03 +0100, you wrote: Hello. On Mon 2003-02-24 at 11:28:05 +, [EMAIL PROTECTED] wrote: > Hello, > > In a table like this: > > ID > Item1 char(100) > Item2 char(100) > . > . > ItemN char(100) > > What's the cleanest way to do this mysql query: > > SELECT * FROM MyTable WHERE AnyCo

Re: How to query an entire row?

2003-02-24 Thread Benjamin Pflugmann
Hello. On Mon 2003-02-24 at 11:28:05 +, [EMAIL PROTECTED] wrote: > Hello, > > In a table like this: > > ID > Item1 char(100) > Item2 char(100) > . > . > ItemN char(100) > > What's the cleanest way to do this mysql query: > > SELECT * FROM MyTable WHERE AnyColumn LIKE '%mysearch%' > > Only

How to query an entire row?

2003-02-24 Thread Jeff Snoxell
Hello, In a table like this: ID Item1 char(100) Item2 char(100) . . ItemN char(100) What's the cleanest way to do this mysql query: SELECT * FROM MyTable WHERE AnyColumn LIKE '%mysearch%' Only way I can think to do it is: SELECT * FROM MyTable WHERE (Item1 LIKE '%mysearch%' OR Item2 LIKE '%my

Re: --- How to query results of a query?

2003-01-16 Thread harm
On Wed, Jan 15, 2003 at 11:55:44PM +, [EMAIL PROTECTED] wrote: > > please look at page 194 of the reference manual... > > >(and if so how do you ask MySQL to create a temp table from the > > results of aquery?) > > here's an example: > > mysql> create temporary table tmp (name varchar(20),

Re:--- How to query results of a query?

2003-01-15 Thread nossareh
please look at page 194 of the reference manual... >(and if so how do you ask MySQL to create a temp table from the > results of aquery?) here's an example: mysql> create temporary table tmp (name varchar(20), owner varchar(20, species varchar(10)); mysql> insert into tmp select name, owner,

Re: --- How to query results of a query?

2003-01-15 Thread Benjamin Pflugmann
Hello. Please start a new thread instead of replying to an existing one. Or else, your message will be sorted with the original thread for people with decent mail readers. On Wed 2003-01-15 at 14:42:05 -0500, [EMAIL PROTECTED] wrote: > How do you query the table that is the results of a query? B

Re: --- How to query results of a query?

2003-01-15 Thread greg55
ley <[EMAIL PROTECTED]> > Subject: --- How to query results of a query? > Date: 16/01/2003 6:42:05 > To: [EMAIL PROTECTED] > > How do you query the table that is the results of a query? > > Must you ask MySQL to... > ...create a temporary table form the results of the f

--- How to query results of a query?

2003-01-15 Thread Will Standley
How do you query the table that is the results of a query? Must you ask MySQL to... ...create a temporary table form the results of the first query ...then query that temporary table ...then delete the temp table when you are done? (and if so how do you ask MySQL to create a temp table from the r

Re: How to query a varchar column's value staring with a string?

2002-10-31 Thread Andre Kirchner
Hi there, I found a way to do it with the following query select * from theTable where 'test' like concat( theColumn, '%' ); Thanks for the help, Andre --- Andre Kirchner <[EMAIL PROTECTED]> wrote: > thanks for the help, but what I really want is to > select all the values that are a substrin

Re: How to query a varchar column's value staring with a string?

2002-10-31 Thread Andre Kirchner
thanks for the help, but what I really want is to select all the values that are a substring of 'test' as 't', 'te', 'tes' and 'test', and so I was trying the query select * from theTable where ( theColumn || '%' ) like 'test'; I think my previous email as a litle bit confusing. Sorry for that :

How to query a varchar column's value staring with a string?

2002-10-31 Thread Jennifer Goodie
select * from theTable where theColumn like 'test%'; or select * from theTable where LEFT(theColumn,4) = 'test'; depending on the table structure and data and indexing, etc. I have seen a performance difference between the two, test and see which works best for your application. Hi there, how c

How to query a varchar column's value staring with a string?

2002-10-31 Thread Andre Kirchner
Hi there, how can I query all the values starting with 'test'? I tried the following query, but it didn't work select * from theTable where ( ( theColumn || '%' ) like 'test' ); Thanks, Andre mySQL __ Do you Yahoo!? HotJobs - Search new jobs dail

Re: how to query for the primary key?

2002-06-14 Thread Egor Egorov
justin, Friday, June 14, 2002, 4:52:12 AM, you wrote: jc> This seems like a dumb question--sorry. Looking at my table it shows jc> 'MUL' instead of 'PRI' like the other tables. Did I forget to code jc> unit_id as primary? Thanks, Justin jc> mysql> desc property_units; jc> ++--

Re: how to query for the primary key?

2002-06-14 Thread Aleksandar Bradaric
Hi, > This seems like a dumb question--sorry. Looking at my table it shows > 'MUL' instead of 'PRI' like the other tables. Did I forget to code > unit_id as primary? Thanks, Justin mysql> show index from property_units; Regards, Sasa »mysql, select, database« ---

how to query for the primary key?

2002-06-13 Thread justin cunningham
This seems like a dumb question--sorry. Looking at my table it shows 'MUL' instead of 'PRI' like the other tables. Did I forget to code unit_id as primary? Thanks, Justin mysql> desc property_units; ++-+--+-+-++ | Field | Typ

Re: How to query SET OPTION variables?

2002-05-03 Thread Jeremy Zawodny
On Fri, May 03, 2002 at 01:22:30PM +0200, Harald Fuchs wrote: > > How about "SHOW OPTIONS [LIKE wild]", nicely accompanying "SHOW VARIABLES"? Yeah, that'd be the way to go, I think. -- Jeremy D. Zawodny, <[EMAIL PROTECTED]> Technical Yahoo - Yahoo Finance Desk: (408) 349-7878 Fax: (408) 349-54

Re: How to query SET OPTION variables?

2002-05-02 Thread Benjamin Pflugmann
Hi. On Thu, May 02, 2002 at 12:02:44AM -0700, [EMAIL PROTECTED] wrote: > On Tue, Apr 30, 2002 at 04:17:00PM +0200, Benjamin Pflugmann wrote: > > Hi. > > > > Maybe I am blind, but I cannot find, how I can query the status of > > one of the variables I can set with SET OPTION. I.e. if I do > > >

How to query SET OPTION variables?

2002-04-30 Thread Benjamin Pflugmann
Hi. Maybe I am blind, but I cannot find, how I can query the status of one of the variables I can set with SET OPTION. I.e. if I do SET OPTION SQL_AUTO_IS_NULL 1 SET OPTION AUTO_COMMIT 1 What is / is there a way to query to current value? I stumbed upon this, when I wanted to recommend to som

How to query???

2001-01-24 Thread Arthur Radulescu
Can anyone help me with this query??? I have a very big table (70.000 rows) which has several rows like this: idproductdescription 1P1desc1 2P1desc2 and I want to transform it into: idproductdescription 1

How to query???

2001-01-24 Thread Arthur Radulescu
Can anyone help me with this query??? I have a very big table (70.000 rows) which has several rows like this: idproductdescription 1P1desc1 2P1desc2 and I want to transform it into: idproductdescription 1

How to query???

2001-01-24 Thread Arthur Radulescu
Can anyone help me with this query??? I have a very big table (70.000 rows) which has several rows like this: idproductdescription 1P1desc1 2P1desc2 and I want to transform it into: idproductdescription 1

RE: How to query and return nearest value...

2001-01-24 Thread Patrick FICHE
Try something like this SELECT price, min(abs(price-value)) as Mini from table group by price order by Mini LIMIT 1 Patrick -Message d'origine- De : Robert Badaracco [mailto:[EMAIL PROTECTED]] Envoyé : mercredi 24 janvier 2001 05:47 À : [EMAIL PROTECTED] Objet : How to query and r

How to query and return nearest value...

2001-01-23 Thread Robert Badaracco
Hi, I have a range of decimal numbers (Prices) in a table column that I'd like to run a query against. I'd like to run a query with a value that returns the closest price to that value if it can't find a match. Is there some function that I can use in my query that will allow me to do this? Than