This is probably a REALLY simple problem, but I'm pretty rusty on SQL. I'm trying to work on someone else's db.
This query is used in a report to display students in a specific Session. Sessions can be numbers, 1, 2, 3... but the field type is set to TEXT.
Here's the SELECT statement:
From the WHERE clause, I want to extract specific values, say everything with "10" in the Sessions field. The problem is that the Sessions field can have multiple entries, such as "2,7,9,10". When I run a report to show all 10's, this query returns all 10's AND all 1's (because of the "*"). If I take out the "*"s, then any row with multiple entries (2,7,9,10) isn't returned.
Any help on how to correct this query?
Thanks in advance
This query is used in a report to display students in a specific Session. Sessions can be numbers, 1, 2, 3... but the field type is set to TEXT.
Here's the SELECT statement:
Code:
SELECT [What session?] AS [session], [last] & ", " & [first] AS Name, [grade1]+Year(Date())-[year1] AS Grade, DLookUp("cvalue","parameters","parameter='weeklytuition'")*weeks([sessions])-DSum("amount","payments","ID=" & [ID])<=0 AS PIF, [Address1] & ", " & [City] & ", " & [State] & " " & [Zip] AS Address, Students.Sessions, Students.[Tel#], Students.School, Students.City
FROM Students
WHERE (((Students.Sessions) [b]LIKE "*" & [What session?] & "*"))[/b]
Any help on how to correct this query?
Thanks in advance