PDA

View Full Version : مشکل در واکشی از چند جدول



imani1983
جمعه 15 اردیبهشت 1391, 22:50 عصر
من کد زیر رو برای جستجو می نویسم اما رکورد مورد نظر را سه بار تکرار می کند.
لطفا راهنمایم کنید با مثال:


select tbl_project.st_no,tbl_project.t_project,tbl_studen t.fname,tbl_student.lname,tbl_ostad.fname,tbl_osta d.lname,tbl_group.code_group,tbl_reshteh.name_resh teh,tbl_zamineh.name_zamineh
from tbl_project,tbl_student,tbl_ostad,tbl_reshteh,tbl_ zamineh,tbl_group
where tbl_project.code_group ='900'
and (tbl_project.t_project Like 'س')
and (tbl_project.st_no=tbl_student.st_number)and(tbl_p roject.code_ostad=tbl_ostad.code_ostad)and(tbl_pro ject.code_zamineh=tbl_zamineh.code_zamineh)and(tbl _project.code_reshteh=tbl_reshteh.code_reshteh)

as13851365
شنبه 16 اردیبهشت 1391, 11:08 صبح
هر فیلدی که در قسمت شرط ازش استفاده می کنی باید در قسمت select انتخاب شده باشد
و یه سری فاصله بین اسم بعضی از فیلدها بودش اینها رو درست و تست کن

select
tbl_project.st_no,
tbl_project.t_project,
tbl_project.code_group,
tbl_project.code_ostad,
tbl_project.code_zamineh,
tbl_project.code_reshteh,

tbl_studen t.fname,
tbl_student.lname,
tbl_student.st_number,

tbl_ostad.fname,
tbl_ostad.lname,

tbl_group.code_group,

tbl_reshteh.name_resh teh,
tbl_reshteh.code_reshteh,

tbl_zamineh.name_zamineh,
tbl_zamineh.code_zamineh

from tbl_project,tbl_student,tbl_ostad,tbl_reshteh,tbl_ zamineh,tbl_group

where

tbl_project.code_group ='900'
and (tbl_project.t_project Like 'س')
and (tbl_project.st_no=tbl_student.st_number)
and(tbl_project.code_ostad=tbl_ostad.code_ostad)
and(tbl_project.code_zamineh=tbl_zamineh.code_zami neh)
and(tbl_project.code_reshteh=tbl_reshteh.code_resh teh)

latifi_y
شنبه 16 اردیبهشت 1391, 12:08 عصر
هر فیلدی که در قسمت شرط ازش استفاده می کنی باید در قسمت select انتخاب شده باشد
و یه سری فاصله بین اسم بعضی از فیلدها بودش اینها رو درست و تست کن

select
tbl_project.st_no,
tbl_project.t_project,
tbl_project.code_group,
tbl_project.code_ostad,
tbl_project.code_zamineh,
tbl_project.code_reshteh,

tbl_studen t.fname,
tbl_student.lname,
tbl_student.st_number,

tbl_ostad.fname,
tbl_ostad.lname,

tbl_group.code_group,

tbl_reshteh.name_resh teh,
tbl_reshteh.code_reshteh,

tbl_zamineh.name_zamineh,
tbl_zamineh.code_zamineh

from tbl_project,tbl_student,tbl_ostad,tbl_reshteh,tbl_ zamineh,tbl_group

where

tbl_project.code_group ='900'
and (tbl_project.t_project Like 'س')
and (tbl_project.st_no=tbl_student.st_number)
and(tbl_project.code_ostad=tbl_ostad.code_ostad)
and(tbl_project.code_zamineh=tbl_zamineh.code_zami neh)
and(tbl_project.code_reshteh=tbl_reshteh.code_resh teh)

متاسفانه تست کردیم اما بازم هم رکورد تکرار رو به ما داد.
من می خواستم بر اساس چند کلمه کلیدی یا مشابه لایک جستجو داشته باشم - وقتی دستور
and (tbl_project.t_project Like 'س')
با OR می نویسیم تعداد رکورد های تکراری سر به فلک می کشد . ممنون می شم دقیق راهنماییم کنید.با سپاس