MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 9th, 2000, 07:28 AM
ilya ilya is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Posts: 4 ilya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi, I was wondering whether it would be possible to find out the value of a column of the latest insert and then select all the rows which have the same value in that, all in one query.

Unclear what I mean? Well, like this:

1. Find out value of column in latest entry
2. Select all rows with the same value as the latest entry

I know how to do this in two calls, but wouldn't it be possible (and faster) to to do it in one call?

Thanks!

Reply With Quote
  #2  
Old September 9th, 2000, 10:55 AM
kudinov kudinov is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 19 kudinov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0

Reply With Quote
  #3  
Old September 22nd, 2000, 10:25 AM
xiaoguiwxd xiaoguiwxd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Posts: 35 xiaoguiwxd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9


1. $lastinsert = mysql_insert_id();
2. select * from yourtablename where yourid = $lastinsert

------------------
Good Good Study
Day Day Up

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Combining multiple SELECTs


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT