SQL inner join
er der nogen som kan hjælpe. jeg prøver at lave min første inner join - som ikke virker.<%
Dim rsResults
Dim rsResults_numRows
Set rsResults = Server.CreateObject("ADODB.Recordset")
rsResults.ActiveConnection = MM_claims_conn_STRING
tsk_sql = "SELECT * FROM dbo.tblDamage WHERE (DateOfDamage between '" & ConvertToSqlDate(Request.Querystring("startdate")) & "' AND '" & ConvertToSqlDate(Request.Querystring("enddate")) & "') "
If Request.QueryString("ship")<>"" Then
tsk_sql = tsk_sql & "AND shipsID = " & Request.QueryString("ship") & " "
End if
If Request.QueryString("flag")<>"" Then
tsk_sql = tsk_sql & "INNER JOIN dbo.tblShips ON dbo.tblDamage.shipsID = dbo.tblShips.IDship AND flagID = " & Request.QueryString("flag") & " "
End if
If Request.QueryString("search")<>"" Then
tsk_sql = tsk_sql & "AND Description LIKE '%" & Request.QueryString("search") & "%' "
End if
If Request.QueryString("type")<>"" Then
tsk_sql = tsk_sql & "AND Type = '" & Request.QueryString("type") & "' "
End if
If Request.QueryString("reported")<>"" Then
tsk_sql = tsk_sql & "AND SurveyedByInsurance = 'Y' "
End if
If Request.QueryString("caseopen")<>"" Then
tsk_sql = tsk_sql & "AND CaseClosed = 'Y' "
End if
'response.write tsk_sql
rsResults.Source = tsk_sql
rsResults.CursorType = 0
rsResults.CursorLocation = 2
rsResults.LockType = 1
rsResults.Open()
rsResults_numRows = 0
%>