dbTalk Databases Forums  

SQL problem

comp.database.oracle comp.database.oracle


Discuss SQL problem in the comp.database.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Calvin Tai
 
Posts: n/a

Default SQL problem - 04-01-2004 , 09:09 PM






Hi,

I have a simple SQL problem. Would appreciate if anyone could help.

I got a table (say, test) which contain two columns A & B. I wanna
merge the first 4 characters of A and 5-8 characters of B in my SELECT
statement. Then group by this column. Therefore i write:

SELECT substr(A, 0, 4) || substr(B, 5, 4) as R, count(*) as C FROM
test GROUP BY substr(A, 0, 4) || substr(B, 5, 4)

THe problem is that i specified substr(A, 0, 4) || substr(B, 5, 4)
twice in my SQL. Is there any ways that i can specify that string
manipulation once only in the SQL?

Best regards,
Calvin

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.