Home » SQL & PL/SQL » SQL & PL/SQL » SQL Question
SQL Question [message #23021] Tue, 12 November 2002 17:10 Go to next message
Rizwan Qazi
Messages: 135
Registered: August 2002
Senior Member
I have tables

desc xyz;
Name Type
----- --------
A_NO VARCHAR2(10)

desc aaa;
Name Type
----- --------
B_NO VARCHAR2(10)
CXP VARCHAR2(20)

select * from xyz;

A_NO
----------
111111111
211111111
221111111
222111111
222211111

select * from aaa;

B_NO CXP
---------- --------------------
111111111 sbc
211111111 sbc
221111111 sbc
222111111 sbc
222211111 sbc

When I type

select A.A_NO, B.* from xyz A, aaa B where A_NO=B_NO;

A_NO B_NO CXP
---------- ---------- --------------------
111111111 111111111 sbc
211111111 211111111 sbc
221111111 221111111 sbc
222111111 222111111 sbc
222211111 222211111 sbc

When I type this

COL A_NO NOPRINT

the query returns

select A.A_NO, B.* from xyz A, aaa B where A_NO=B_NO;

B_NO CXP
---------- --------------------
111111111 sbc
211111111 sbc
221111111 sbc
222111111 sbc
222211111 sbc

However, when I type

create table moo as select A.A_NO, B.* from xyz A, aaa B where A_NO=B_NO;

the table structure created is

desc moo;
Name Type
----- --------
A_NO VARCHAR2(10)
B_NO VARCHAR2(10)
CXP VARCHAR2(20)

How can I create a table structure with the same query using * and not including field A_NO in the structure?

Rizwan
Re: SQL Question [message #23022 is a reply to message #23021] Tue, 12 November 2002 18:54 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Just don't include A.A_NO in the query...
Re: SQL Question [message #23317 is a reply to message #23021] Sat, 30 November 2002 08:26 Go to previous message
SHANAZ
Messages: 12
Registered: October 2002
Junior Member
You must have to mention all the coulumns with as select query

thanks i hope my comments will decrease your confusion

thanks and regards
Previous Topic: SQL QUERY -HELP
Next Topic: ORA-01722: invalid number in cursor
Goto Forum:
  


Current Time: Tue May 14 19:17:10 CDT 2024