当我执行查询显示错误
问题描述:
select b.stud_id, stud_name, srm_rank_code, stud_birth_place, stud_indos, stud_addr_1, stud_place, stud_state
stud_pincode, stud_country, stud_telephone, stud_mobile, stud_email, stud_dob, stud_pp_no, stud_pp_issue, stud_pp_idt
stud_cdc_no, stud_cdc_issue, stud_cdc_idt, stud_company, stud_seatime,
(select file_data from file_system.dbo.FileDatas where delstate<>1 and
[file_id]= (select top 1 [file_ID] from stud_File_map f
where f.stud_id=s.stud_id and delstate<>1 and file_map_type='PHOTO')) as 'PHOTO'
(select file_data from file_system.dbo.FileDatas where delstate<>1 and
[file_id]= (select top 1 [file_ID] from stud_File_map f
where f.stud_id=s.stud_id and delstate <> 1 and file_map_type='SIGNATURE')) as 'SIGNATURE'
from batch_course_registration a,
course_registration b, student s where s.stud_id = b.stud_id and s.stud_active <> 'D' and
b.cr_bill_no=a.cr_bill_no and a.bcr_batch_id= 'B8753' and b.cr_active='A'
当我执行上述查询时,显示错误如下
关键字'as'附近的语法不正确。
请帮我查询错误我是什么意思制作。
问候
Narasiman P.
When i execute the above query shows error as follows
Incorrect syntax near the keyword 'as'.
please help me from my query what is the mistake i made.
Regards
Narasiman P.
答
看看在您的查询中,它将显示为PHOTO
- 您立即进入另一个子查询...应该有一个AND
或或
这是一个非常糟糕的SQL - 而不是所有这些子查询都考虑使用一些连接......如果没有别的话,它会更容易阅读
Have a look at your query where it saysas 'PHOTO'
- you immediately go into another sub-query ... there should be anAND
or anOR
That is a truly awful piece of SQL - instead of all of those sub-queries consider using some joins instead ... it will be easier to read if nothing else