How to get last record for each product

2010-07-20 Thread Tompkins Neil
Hi, I have a list of product orders in a table with the following structure : OrderID ProductID OrderDate OrderCost What query would I need to get the last order for each productID ? Cheers, Neil

RE: How to get last record for each product

2010-07-20 Thread Jay Blanchard
[snip] I have a list of product orders in a table with the following structure : OrderID ProductID OrderDate OrderCost What query would I need to get the last order for each productID ? [/snip] MAX(OrderDate) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To

Re: How to get last record for each product

2010-07-20 Thread Aveek Misra
SELECT ProductID, MAX(OrderDate) FROM table GROUP BY ProductID; or if you want all the columns SELECT * FROM table a, (SELECT ProductID, MAX(OrderDate) as MaxDate FROM table GROUP BY ProductID) as b WHERE a.ProductID = b.ProductID AND a.OrderDate = b.MaxDate; Tompkins Neil wrote: Hi, I

Insuring select returns the last record for a given day.

2006-03-27 Thread Paul Halliday
290248558 119939485 0 NULL 2289391143430290AN122001697436588 20836217840 NULL I am trying to read the last record for each column for a given day (when the stats are input they are already a sum, so the last entry will be the cumulative total for each day

Fwd: Insuring select returns the last record for a given day.

2006-03-27 Thread sheeri kritzer
-- Forwarded message -- From: sheeri kritzer [EMAIL PROTECTED] Date: Mar 27, 2006 1:18 PM Subject: Re: Insuring select returns the last record for a given day. To: Paul Halliday [EMAIL PROTECTED] I have a similar table, so I tried out your query on the table I have: select

Elegant way: select last record from table

2005-01-21 Thread Jerry Swanson
I'm interesting to know what is the best way to select last inserted record. This can do it ORDER BY id desc limit 5 .. but .. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: Elegant way: select last record from table

2005-01-21 Thread Jay Blanchard
[snip] I'm interesting to know what is the best way to select last inserted record. This can do it ORDER BY id desc limit 5 .. but .. [/snip] That is generally best, but if you have an auto-increment field SELECT MAX(auto-increment field), * FROM `table` -- MySQL General Mailing List For

How to get the last record from the slected record set

2004-08-23 Thread Manisha Sathe
I am having more than 10 records in a table. I want to select only first top 10 records (depending on one field score) and then want to select 10th position record. select * from table1 order by score desc LIMIT 10 This will give me 10 records but then how to get the last record ? Thanks

Re: How to get the last record from the slected record set

2004-08-23 Thread Karl Pielorz
This will give me 10 records but then how to get the last record ? order by score asc limit 1 [i.e. turn it around and pick the 1st (which will be the last because it's ordered the other way)] :-) -Kp -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http

Re: How to get the last record from the slected record set

2004-08-23 Thread Martijn Tonies
I am having more than 10 records in a table. I want to select only first top 10 records (depending on one field score) and then want to select 10th position record. select * from table1 order by score desc LIMIT 10 This will give me 10 records but then how to get the last record ? Cycle them

Re: How to get the last record from the slected record set

2004-08-23 Thread Manisha Sathe
[EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, August 23, 2004 8:34 PM Subject: Re: How to get the last record from the slected record set --On 22 August 2004 20:31 +0800 Manisha Sathe [EMAIL PROTECTED] wrote: I am having more than 10 records in a table. I want to select only first top 10

Re: How to get the last record from the slected record set

2004-08-23 Thread Manisha Sathe
yes, but is there any better way of doing it ? regards Manisha - Original Message - From: Karl Pielorz [EMAIL PROTECTED] To: Manisha Sathe [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, August 23, 2004 8:34 PM Subject: Re: How to get the last record from the slected record set

Re: How to get the last record from the slected record set

2004-08-23 Thread Roger Baklund
* Manisha Sathe I want to select first 10 records out of 100. And then get the 10th position. If i make use of order by score asc limit 1 then I will get 100th record, How shall i pick up 10th position? Try this: order by score desc LIMIT 9,1 -- Roger -- MySQL General Mailing

Re: How to get the last record from the slected record set

2004-08-23 Thread gerald_clark
Manisha Sathe wrote: I want to select first 10 records out of 100. And then get the 10th position. If i make use of order by score asc limit 1 then I will get 100th record, How shall i pick up 10th position? regards Manisha order by score desc limit 9,1 -- MySQL General Mailing List For list

Re: How to get the last record from the slected record set

2004-08-23 Thread Karl Pielorz
--On 22 August 2004 21:05 +0800 Manisha Sathe [EMAIL PROTECTED] wrote: I want to select first 10 records out of 100. And then get the 10th position. If i make use of order by score asc limit 1 then I will get 100th record, How shall i pick up 10th position? I'm not quite sure I follow what

RE: How to get the last record from the slected record set

2004-08-23 Thread Kerry Frater
with the DB components I can simply tell the Navigator to get the last record. Fairly straight forward. I have recently found that using the DB componensts (so I am told) creates a local dataset which means that ALL rows selected are transferred to a local dataset for you to have a simple goto last record

Re: How to get the last record from the slected record set - Thanks

2004-08-23 Thread Manisha Sathe
Thanks to all of, I could get it Thanks Manisha - Original Message - From: Karl Pielorz [EMAIL PROTECTED] To: Manisha Sathe [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, August 23, 2004 9:52 PM Subject: Re: How to get the last record from the slected record set --On 22

Query last record in table

2004-07-05 Thread Mike Blezien
Hello, what is the most effecient way to query the last record in a table, if querying the primary key(acctid) column ?? I've tried select *,max(acctid) as lastid from subscribers where acctid = 'lastid' group by acctid but this returns nothing ?? TIA :) -- MikemickaloBlezien

Re: Query last record in table

2004-07-05 Thread Paul DuBois
At 13:52 -0500 7/5/04, Mike Blezien wrote: Hello, what is the most effecient way to query the last record in a table, if querying the primary key(acctid) column ?? What do you mean by last? The row containing the largest acctid value? You might try ... ORDER BY acctid DESC LIMIT 1. I've tried

[Fwd: Query last record in table]

2004-07-05 Thread Mike Blezien
cancel this, found my problem :) this query worked: SELECT * FROM subscribers ORDER BY acctid DESC LIMIT 1 Original Message Subject: Query last record in table Date: Mon, 05 Jul 2004 13:52:28 -0500 From: Mike Blezien [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Organization

RE: Query last record in table

2004-07-05 Thread Scott Johnson
Hi Tia, I'm not sure, but my old SQL trick was to do a select * top 1 from subscribers order by acctid desc Scotty. -Original Message- From: Mike Blezien [mailto:[EMAIL PROTECTED] Sent: July 5, 2004 2:52 PM To: MySQL List Subject: Query last record in table Hello, what is the most

Last Record Pulling my hair out :D

2004-04-22 Thread James
I'm trying to select the last record (row) in a db. I'm trying with a select: Select * from job_log_2004 where job_log_2004.JobID = (select max(job_log_2004.JobID) from job_log_2004) and it fails. The part about select max works and returns a number. What on earth am I doing wrong

RE: Last Record Pulling my hair out :D

2004-04-22 Thread John McCaskey
[mailto:[EMAIL PROTECTED] Sent: Thursday, April 22, 2004 12:43 PM To: [EMAIL PROTECTED] Subject: Last Record Pulling my hair out :D I'm trying to select the last record (row) in a db. I'm trying with a select: Select * from job_log_2004 where job_log_2004.JobID = (select max(job_log_2004.JobID

Re: Last Record Pulling my hair out :D

2004-04-22 Thread Daniel Clark
Think you want: Select max(job_id) from job_log_2004 I'm trying to select the last record (row) in a db. I'm trying with a select: Select * from job_log_2004 where job_log_2004.JobID = (select max(job_log_2004.JobID) from job_log_2004) and it fails. The part about select max works

RE: Last Record Pulling my hair out :D

2004-04-22 Thread James
John M, Thanks for the solution, gave me exactly what I was looking for. Thanks, James -Original Message- From: John McCaskey [mailto:[EMAIL PROTECTED] Sent: Thursday, April 22, 2004 3:54 PM To: James; [EMAIL PROTECTED] Subject: RE: Last Record Pulling my hair out :D Try, SELECT

AW: retrieving last record for all distinct users

2004-03-20 Thread B. Fongo
An: mysql Betreff: retrieving last record for all distinct users I have a table SESSIONS with the following fields: SESSION_ID LOGIN IP TIMESTAMP I am trying to select the last login record for all distinct users. The closest I can get to is: select distinct LOGIN

RE: retrieving last record for all distinct users

2004-03-20 Thread Matt Chatterley
Message- From: motorpsychkill [mailto:[EMAIL PROTECTED] Sent: 20 March 2004 01:18 To: mysql Subject: retrieving last record for all distinct users I have a table SESSIONS with the following fields: SESSION_ID LOGIN IP TIMESTAMP I am trying to select

RE: retrieving last record for all distinct users

2004-03-20 Thread Matt Chatterley
: retrieving last record for all distinct users Making the assumption that you are running a version of MySQL which supports subqueries, I believe you could use: SELECT Login, TimeStamp, IP FROMSessions S INNER JOIN ( SELECT MAX(TimeStamp) TimeStamp, Login

retrieving last record for all distinct users

2004-03-19 Thread motorpsychkill
I have a table SESSIONS with the following fields: SESSION_ID LOGIN IP TIMESTAMP I am trying to select the last login record for all distinct users. The closest I can get to is: select distinct LOGIN, TIMESTAMP, IP from SESSIONS group by LOGIN order by

Re: retrieving last record for all distinct users

2004-03-19 Thread Michael Stassen
First, since you group by LOGIN, you don't need DISTINCT. The problem is that GROUP BY is designed for use with aggregate functions, not individual rows. So which values of SESSION_ID, IP, and TIMESTAMP you should get is undefined. The manual gives 3 solutions to this problem:

Last record

2004-02-09 Thread Patricio Gigoux
Hi: How Can I do for after a query I put at the its last record? Thanks in advance -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Last record

2004-02-09 Thread Michael Satterwhite
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 09 February 2004 08:44, Patricio Gigoux wrote: Hi: How Can I do for after a query I put at the its last record? I'm not sure I followed the question, but I think you're asking how to look at the last record in the set you just returned

Re: Last record

2004-02-09 Thread Patricio Gigoux
] Sent: Monday, February 09, 2004 10:29 AM Subject: Re: Last record -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 09 February 2004 08:44, Patricio Gigoux wrote: Hi: How Can I do for after a query I put at the its last record? I'm not sure I followed the question, but I think you're

Finding information in the last record

2003-10-29 Thread Hunter, Jess
Being real new to MySQL I am having difficulty finding information on how to retrieve data from the last record in a database. I have tried using the SELECT LAST_INSERT_ID() statement but that only works on a per connection basis and doesn't help all the times. Basically I want to goto the end

Re: Finding information in the last record

2003-10-29 Thread Martijn Tonies
Hi Jess, Being real new to MySQL I am having difficulty finding information on how to retrieve data from the last record in a database. Mind you - the last record doesn't have to be the last record if you're running an application with multiple users. That said, the last record in any table

Re: Finding information in the last record

2003-10-29 Thread jeffrey_n_Dyke
: Subject: Finding information in the last record 10/29/2003 10:50

Re: Last record

2003-02-11 Thread Roger Baklund
* Deependra b. Tandukar How do I select the very last record in a column in MySQL database? The expression last record implies that there is an ORDER in your query... if you add the keyword DESC and a LIMIT 1, you should get the desired result: SELECT * FROM mytable ORDER BY mycolumn DESC

Re: Last record

2003-02-11 Thread Keith C. Ivey
On 11 Feb 2003, at 10:30, Deependra b. Tandukar wrote: How do I select the very last record in a column in MySQL database? That depends on what you mean by last record. What are you sorting by? Once you've figured that out, do a query like this: SELECT * FROM table_name ORDER

Last record

2003-02-10 Thread Deependra b. Tandukar
Dear all, How do I select the very last record in a column in MySQL database? Regards, DT - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive

Last record

2003-02-10 Thread Deependra b. Tandukar
Dear all, How do I select the very last record in a column in MySQL database? Regards, DT - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list

Re: password / last record

2002-10-10 Thread kayamboo
Message - From: "Arjen Lentz" [EMAIL PROTECTED] To: "kayamboo" [EMAIL PROTECTED] Cc: "list mysql" [EMAIL PROTECTED] Sent: Thursday, October 10, 2002 1:08 PM Subject: Re: password / last record Hi, On Thu, 2002-10-10 at 10:57, kayamboo wrote: 1. Is there a

password / last record

2002-10-09 Thread kayamboo
sql, query Hello Folks 1. Is there anyway to know the string value of the password using the encrypted value , from the mysql.user table ? 2. How can I know the most recently entered record, that does not have an AUTOINCREMENT column ? Thanks for the tips.

Re: password / last record

2002-10-09 Thread Arjen Lentz
Hi, On Thu, 2002-10-10 at 10:57, kayamboo wrote: 1. Is there anyway to know the string value of the password using the encrypted value , from the mysql.user table ? No. It's scrambled with a one-way (lossy) algorithm. 2. How can I know the most recently entered record, that does not

How to select last record?

2002-06-03 Thread Konstantin Yotov
Hello! :) Is there any chance to select last record in one sql statement? Thanks. Kosyo __ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com

RE: How to select last record?

2002-06-03 Thread Jay Blanchard
[snip] Is there any chance to select last record in one sql statement? [/snip] Try this query; SELECT * FROM tableName ORDER BY id DESC LIMIT 1 HTH! Jay - Before posting, please check: http://www.mysql.com/manual.php

last record alert

2001-07-23 Thread Sommai Fongnamthip
Dear, I decided to collect data into MySQL for realtime display usage. How could I know there are new records add to table and retrieve them to display? Is there different to do this with VB (Client/Server style) and PHP (Web Bases Style)? Thanks Sommai Fongnamthip