October 28th, 2003, 09:57 AM
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:
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.
October 28th, 2003, 07:52 PM
Problem all sorted !!!