Joannatang
July 29th, 2004, 10:20 AM
Hi all
Hope you can help me on something! In total, I've created two pages. The first page shows the results from the search of various patients using the variable (id) i.e. 's' displays all patients with surnames beginning with s). From this page, I've created a session variable (nm). The second page shows further details of that particular surname once the surname is clicked from the first page. The nm session variable will enable the user to the first page from the second page.
However, in the SQL query from the first page, I put in 'or'(see below), the session variable works but doesn't search the surnames according to what the user wants.
SELECT Patient.PatientID, Title.Title, Patient.Forenames, Patient.Surname
FROM Title INNER JOIN Patient ON Title.TitleID = Patient.TitleID
WHERE Patient.Surname LIKE 'id%' or 'nm'
But if I type in 'and', the session variable doesn't work and the searching surnames work.
SELECT Patient.PatientID, Title.Title, Patient.Forenames, Patient.Surname
FROM Title INNER JOIN Patient ON Title.TitleID = Patient.TitleID
WHERE Patient.Surname LIKE 'id%' and 'nm'
Does anyone know the solution to this problem? Thanks. :wave:
Hope you can help me on something! In total, I've created two pages. The first page shows the results from the search of various patients using the variable (id) i.e. 's' displays all patients with surnames beginning with s). From this page, I've created a session variable (nm). The second page shows further details of that particular surname once the surname is clicked from the first page. The nm session variable will enable the user to the first page from the second page.
However, in the SQL query from the first page, I put in 'or'(see below), the session variable works but doesn't search the surnames according to what the user wants.
SELECT Patient.PatientID, Title.Title, Patient.Forenames, Patient.Surname
FROM Title INNER JOIN Patient ON Title.TitleID = Patient.TitleID
WHERE Patient.Surname LIKE 'id%' or 'nm'
But if I type in 'and', the session variable doesn't work and the searching surnames work.
SELECT Patient.PatientID, Title.Title, Patient.Forenames, Patient.Surname
FROM Title INNER JOIN Patient ON Title.TitleID = Patient.TitleID
WHERE Patient.Surname LIKE 'id%' and 'nm'
Does anyone know the solution to this problem? Thanks. :wave: