Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 searching three field for values

Author  Topic 

OMB
Yak Posting Veteran

88 Posts

Posted - 2001-06-15 : 05:14:42
I have created an update, that is dependant on the values of three different fields, when I use one field it's fine but when I try to add the other two fields it returns no records.

The code below works when using one field search criteria

SELECT stmaos.student_id, stmaos.aos_code, stmaos.aoscd_link,
stcsthmo.subj_area1
FROM stmaos INNER JOIN
stcsthmo ON stmaos.aos_code = stcsthmo.aos_code
WHERE (LEFT(stmaos.aoscd_link, 2) IN ('11', '12', '13', '14')) AND
(len(stmaos.aoscd_link) = 8) AND
(stmaos.acad_period = '1999') AND
(stcsthmo.subj_area1 = 'mus') OR
(stcsthmo.subj_area1 = 'muc')

but I need the query to look at Subj_area2, and 3 for the same values.

i.e if MUC or Mus exist in subj1 or subj2 or Subj3
then update

hope this makes sense

Thanxs



   

- Advertisement -