Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

columns and data...

Status
Not open for further replies.

016

Programmer
May 8, 2000
17
0
0
US
I have a field USA, and 4 other North-east, south-east, north east and south east. I have to delete these 4 fields . they have data.  I want to have the same info when I query the USA. so i WILL HaVE IN MY TBLE ONLY THE USA and not the regions. How can I do? Thanks
 
What RDBMS are you using?&nbsp;&nbsp;If it's Oracle 8i, you can drop the unwanted columns.<br>Otherwise, you might want to try<br><br>Step 1 - <br>CREATE TABLE temp_mytable AS<br>SELECT all_columns_except_the_ones_you_do_not_want<br>FROM my_table;<br><br>Step 2 -<br>DROP TABLE my_table;<br><br>Step 3 -<br>RENAME temp_mytable TO my_table;<br><br>
 
giving complementary info:<br>I am using oracle 7 and I have 15 other fields in the same table. can i proceed with your answer. what about the data contained in the fields North-east, north-west, south_west and south_east.&nbsp;&nbsp;i will lose them, right if I wont select the fields? I want to query the usa field and get the info in the north-east, south-east, north_west and south-west.<br>thanks again
 
for your create table, use the following select: <br>select col1,col2,north-east,col5,col6<br>from anytable<br>where north-east is not null<br>union<br>select col1,col2,north-WEST,col5,col6<br>from anytable<br>where north-WEST is not null<br>union......<br><br>You could modify the where clause further.....<br>you get the picture?<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top