Michael Dinowitz wrote:
> Is there an easy way or selecting all rows from one table for insertion
> into another where the email is distinct along with whatever ID is with it?
> If I just do a plain distinct, it'll duplicate emails as the ID will always
> be distinct. I can do this a few ways, but none of them seem tight or clean
> enough. Any ideas?

INSERT INTO newtable (email, ID)
SELECT    email, MAX(ID)
FROM      oldtable
GROUP BY  email

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
This list and all House of Fusion resources hosted by CFHosting.com. The place 
for dependable ColdFusion Hosting.
http://www.houseoffusion.com/banners/view.cfm?bannerid=11

Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2093
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to