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;
> >>
> >>
>
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
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
>
> ---
>
.
-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
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
"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
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
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
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
>
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?
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]
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
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.
>
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
;
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
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
- 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,
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
..
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
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
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
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
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
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
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
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
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
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),
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,
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
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 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
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
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 :
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
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
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> ++--
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«
---
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
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
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
> >
>
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
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
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
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
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
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
63 matches
Mail list logo