Gena
Posts: 591
|
| Posted: 02/24/2009, 11:17 AM |
|
I have some SELECT, as WHERE I have something like this
select ... where .... and prof like '%" . $prof . "%'
it works if there is some info in "prof" field. If there is NO info - it doesn't work (sure it works, but SELECT returns nothing).
But I need act like:
if there is info in prof - then check this field with LIKE
if ther is no info - do not check ever this field
i'm a bit confused. please advise.
_________________
Gena |
 |
 |
dataobjx
Posts: 181
|
| Posted: 02/24/2009, 1:56 PM |
|
The easiest way to do this is to create a view.
In the view you would use sql similar to...
select ... where prof is not null
Thus the view never returns records where prof is null
Now, you can use your original select statement against the view rather than the table.
_________________
www.DataObjx.net
www.mydigitalapps.com |
 |
 |
Gena
Posts: 591
|
| Posted: 02/24/2009, 2:15 PM |
|
dataobjx, thanks
I have made some modification and it works now:
and (prof like '%" . $prof . "%' or prof is NULL)
_________________
Gena |
 |
 |
|