Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

urgent help with comparison operators needed

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
it looks like this--
"SELECT ass.projid, staffid, proj.projid, projname FROM ass, proj WHERE proj.projid=ass.projid AND ass.staffid like '%" & staffid & "%'"
im having trouble with the last part of the statement where comparing staffid's- the = operator isn't recognised and this 'like' operator is returning queries where the staffid is part of the other staffid. For example, its returning info for staff member 13,33 when it is staff mem 3!!
any quick suggestions would be fantastic..cheers people..
 
SELECT ...
WHERE ...
AND ass.staffid like '%staffid%';

try that.
 
If StaffID is numeric, use =. It appears that you are dynamically building the SQL statement in code. Which client are you using and which RDMS are you querying?

If StaffID is a varuable in you program use the following sysntax. Of course the exact syntax depends on your client.

sSQL="SELECT ass.projid, staffid, proj.projid, projname
FROM ass, proj
WHERE proj.projid=ass.projid
AND ass.staffid = " & format(staffid)
Terry L. Broadbent
Programming and Computing Resources
 
thanks for your all your help, it is now sorted...
the "& staffid &" worked it out after its conversion to an integer when i put it into the variable....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top