|
|
|
Forum Member
      
Group: Forum Members
Last Login: 8/26/2008 8:44:16 AM
Posts: 35,
Visits: 232
|
|
Hi,
Can anyone tell me why i am getting this error.
select * from emp a where (select emp_no from emp b where a.emp_no=b.emp_no) >5;
*** Failure 3706 Syntax error: expected something between ')' and '>'.
Statement# 1, Info =80
*** Total elapsed time was 1 second.
But this works fine in oracle database.
we can do this in different way but, i want to do it in same way. Could anyone suggest on the error.
Regards:
Monika
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 8/14/2008 7:33:06 AM
Posts: 28,
Visits: 152
|
|
i think foll is the right query...let know in case of wrong query..
select * from employee a
where 5 <
(select employee_number from employee b where a.employee_number=b.employee_number)
Dhiraj P
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: Yesterday @ 3:13:33 PM
Posts: 133,
Visits: 359
|
|
Hello,
Exactly what are you trying to achieve is pretty ambigious. The query you are trying to write can be easily written as:
SELECT * FROM emp a WHERE a.emp_no = a.emp_no;
If you want to have a self join then you should be doing something as follows:
SELECT * FROM emp a INNER JOIN emp b ON a.emp_no = b.emp_no WHERE b.emp_no > 5;
HTH.
Regards,
Adeel
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 8/26/2008 8:44:16 AM
Posts: 35,
Visits: 232
|
|
Hi Adeel,
in the where condition i want to a boolean expression. if it is true then it has to give me all the employee details.
This runs in oracle but not in teradata.
Please give some alternative for me.
select emp_id from emp a where (
(select emp_no from emp_sk where emp_id = a.emp_id and skill = 'AC_DT_TS') >=11 and
(select emp_no from emp_sk where emp_id = a.emp_id and skill = 'AC_DT_TS') <=15 and
(select emp_no from emp_sk where emp_id = a.emp_id and skill = 'AC_US') = 1 and
(select emp_no from emp_sk where emp_id = a.emp_id and skill = 'AC_EN') = 1 and
(select emp_no from emp_sk where emp_id = a.emp_id and skill = 'AC_Active') = 1)
Advance thanks
Regards:
Monika
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: Yesterday @ 3:13:33 PM
Posts: 133,
Visits: 359
|
|
Is it giving some sort of error?
Regards,
Adeel
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 8/26/2008 8:44:16 AM
Posts: 35,
Visits: 232
|
|
Yes Adeel.The error is :
$
*** Failure 3706 Syntax error: expected something between ')' and '">="'.
Statement# 1, Info =252
*** Total elapsed time was 1 second.
Regards:
Monika
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: Yesterday @ 3:13:33 PM
Posts: 133,
Visits: 359
|
|
Ok, can you remove the SELECTs used in WHERE clause and re-write the query using JOINS?
I guess that is the only way to to something similar.
Regards,
Adeel
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: 8/26/2008 8:44:16 AM
Posts: 35,
Visits: 232
|
|
Hi Adeel,
Thanks for your quick reply. I tried in many ways but in vein.
Could you please suggest, how this can be acheived.
Thanks is advance.
Regards:
Monika
|
|
|
| | |