Unix Technical Forum

INSERT using SELECT results

This is a discussion on INSERT using SELECT results within the MySQL General forum forums, part of the MySQL category; --> Hi, I have a table LOCAIS with: id type desc 1 t1 blah blah 2 t1 uihuih 3 t2 ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 06:49 AM
Miguel Vaz
 
Posts: n/a
Default INSERT using SELECT results


Hi,

I have a table LOCAIS with:

id type desc
1 t1 blah blah
2 t1 uihuih
3 t2 pokpokp


I want to list only the distinct types and create a table with those results.
I know how to list the distinct and i thought i got the insert
right, but it doesnt work:

INSERT INTO ztipos('type') SELECT DISTINCT type FROM locais

Whats wrong with that command?
I want the result to be:
results table ZTIPOS:

id type
1 t1
2 t2


Thanks

Miguel

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:12 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com