|
| |
|
|
Guest
|
Search query - 3/15/2001 20:44:00
I am writing an sql query using the DRW as follows: SELECT * FROM employee WHERE (emp_name = '::emp_name::' OR emp_name= ") AND (project = ': roject::' OR project = ")I am also returning several other fields in the same table, while only searching by EMP_NAME and PROJECT This does not produce desired results. If I search on the emp_name and enter Smith with nothing in the project field i am returned all the Smiths. This is fine. If i just enter the project field and put in Overtime, i get all of the people working on Overtime project. If I enter Smith and Overtime I get evryone named Smith as well as everyone working on Overtime Project. What I would like to do Is to JUST get Everyone named Smith who is working on OVertime and no one else. In essence, Id like to add more search fields but just be returned the values I put into the fields, and if a filed is left blank, Id just like to search on the fields that i entered criteris into and would like to be returned values that match all fields entered. I dont want every Smith and Evere person who worked on Overtime, just the smiths who worked on overtime. Hope i made my self clear. Thanks
|
|
|
|
Vince from Spain
Posts: 658 From: Madrid Spain Status: offline
|
RE: Search query - 3/15/2001 13:21:00
Hi Rebecca, I think it might just be because you have a couple of typos. Firstly, I think you want to be checking not emp_name='' but '::emp_name::'='' also, that is not one double quote at the end of the string, but two single quotes denoting the "empty" string.Try pasting this in . . . SELECT * FROM employee WHERE (emp_name = '::emp_name::' OR '::emp_name::'='') AND (project = '::project::' OR '::project::'='') Vince
------------------ Internet Business Solutions S.L.(Spain)
|
|
|
|
Guest
|
RE: Search query - 3/15/2001 14:04:00
Vince, Thanks for the help. This query seems to work but the only problem is,every time i call the page, the first time i call it I get a whole bunch of results returned as the page opens(i didnt enter any search criteria). But once the page is opened and I enter Criteria into the search fields It seems to work great. Any idea how i can have the page load without any results shown when it loads??
|
|
|
|
Vince from Spain
Posts: 658 From: Madrid Spain Status: offline
|
RE: Search query - 3/15/2001 15:57:00
One quick and dirty fix springs to mind. On step 3 of the DRW, more options, in the default values section, give all the input fields rubbish default values that won't match with anything, like "werkjsdwerh" for instance.Vince
------------------ Internet Business Solutions S.L.(Spain)
|
|
|
|
Vince from Spain
Posts: 658 From: Madrid Spain Status: offline
|
RE: Search query - 3/15/2001 16:58:00
Oooops . . . please disregard that last post as I've just realized it is a load of rubbish. If you have default values, they will be used whenever your field is blank which defeats the whole purpose.  ------------------ Internet Business Solutions S.L.(Spain)
|
|
|
|
Guest
|
RE: Search query - 3/16/2001 20:38:00
So Vince, what do ya think hun. The query seems to work fine except for the first time when i load the page I am returned a whole bunch of fields from my table. Other then that subseequent queries run fine
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|