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 |