
September 15th, 2003, 03:53 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
|
|
|
Problems with SQL Query and a partial search - PLEASE HELP !
First of all I would like to say HI to everyone here ! and I hope I can get my little stupid problem solved. I also want to appologize for all my many mistake and bad written. I am not good in english cause I live in Montreal and my first language is french, but I still think I can be understanded and people can help me and that I might could help some people.
Here is my problem. I am in stage in a company where I need to solve the problems there and addapt t he code to be bettet and faster and help the users to work easier. I am not that good with SQL that much and I always make some little mistake some time stupid some time worse probably. ok I think the introduction is enough long.
I don't really understand why I can use the "%" and the "_" on a query string and that on another one I just can't.
If I don't use the special caracters I will get the answer but in my program, the users need to be able to use the * and ? options. It's work fines for the city and road name but doesn't work at all when you are searching for the VPM number (code projet). soo it's kinda weird.
-------------------------------------------------------------------------------
select count(releve.noReleve) FROM Ville INNER JOIN (Rue INNER JOIN
((Compagnie INNER JOIN Releve ON Compagnie.noCie = Releve.noCie)
INNER JOIN Adresse ON Releve.noReleve = Adresse.noReleve)
ON Rue.noRue = Adresse.noRue) ON Ville.noVille = Rue.noVille
where codeProjet = 'vpm%';
on this query I am trying to know how many project name start with VPM but my result is 0 and I know I have some.
cause if I do the same thing but I use VPM1364 has my query I will get 2 answer. like here.
select count(releve.noReleve) FROM Ville INNER JOIN (Rue INNER JOIN
((Compagnie INNER JOIN Releve ON Compagnie.noCie = Releve.noCie)
INNER JOIN Adresse ON Releve.noReleve = Adresse.noReleve)
ON Rue.noRue = Adresse.noRue) ON Ville.noVille = Rue.noVille
where codeProjet = 'vpm1364';
and if I try to use VPM1364% (added the %) it won't find me any results either.
I really don't understand that error. Cause I am doing something really similar with city and roads name and it's work fine. I can use the "%" and "_" caracters and it will find my answer like I want to. It's only with CodeProjet that it doesn't work. Even if it's not a primary key and it's attribute is a string shouldn't be a problem.
I would appreciate if someone could tell me the problem or how to by-pass it ! I just don,t know ! I never got something like that before. May be it's just because I am tired I don't know.
thank you for all your time and help.
__________________
|