
October 28th, 2003, 09:57 AM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
joining a view to match main data in search query
I am currently building a telephone directory, i'm at the stage where I have the search functions runing smoothly. Except
the way I have the database set up is that the main table holds the business type as a numeral which was entered from
another table with coresponding names.
I have built views to tie these two tables together.
Now once a person searchs the listings they currently recieve a page of results, it is here that the problem occurs.
I need to to in my sql statment tie the main table of data to the view to pull the business type name out instead of the
business type numeral which is contained within the main data table.
Here is my current Sql Statement:
SELECT *
FROM dbo.MAIN, dbo.VIEW_BUSINESS_NAME
WHERE ENTRY_TYPE LIKE 'varSearchType' AND LAST_NAME LIKE '%varName%' AND INITIAL LIKE '%varInitial%' AND STREET_NAME LIKE
'varStreet' AND STATE LIKE 'varState' AND REGION LIKE 'varRegion' AND BUSINESS_TYPE LIKE 'varBusinessType' AND
dbo.VIEW_BUSINESS_NAME.Expr1 = dbo.MAIN.BUSINESS_TYPE
ORDER BY LAST_NAME
It is being put together in dreamweaver mx.
This is returning a multiple list of the one business repeated for as many listings as there are for that business type!
Hope this makes sense it's very early in the morning.
|