Tricky sql's

Database

Tricky sql's

Hi,

I met with a scenario where i need to perform the following activities .could any one help me on the sql 's for the same?

scenario 1:
-------------
TableA has only on column,ColumnA
TableA
ColumnA
1
2
3

Expected result

1 2 3

Scenario2:
------------

TableA has one column,ColumnA
TableB has one column ,ColumnB
TableA
columnA
1
2
3

TableB
ColumnB
A
B
C

Expected result
1 A
2 B
3 C

3 REPLIES

Re: Tricky sql's

These sql's are far from being 'tricky'. At lest for a regular SQL developer.

I feel the scent of some kind of homework...

Anyway:

1.- Take a look at RECURSIVE QUERIES.
2.- Take a look at ANALYTICAL FUNCTIONS.

Cheers.

Carlos.

Re: Tricky sql's

Hi Carlos

Have got a solution using analytical functions and case statements for scenario 1..But couldnt get thru the scenario 2..could you help me out in this..Any hint will be appreciated

Re: Tricky sql's

I would do #1 with recursive query, and #2 using analytical function (rownumber, rank...).

HTH.

Cheers.

Carlos