Solved

Fulltext-search with field as searchvalue

Posted on 2013-06-20
1
197 Views
Last Modified: 2013-06-20
Hi
I have the following code:
SELECT *,
(SELECT TOP 1 Datum FROM foOfferte_M1 B 
WHERE Kundennummer = 5 and B.Baustelle = A.Baustelle 
ORDER BY datum DESC) AS DatumOfferte
FROM foBaustellen_M1 A WHERE KundenLaufnummer = 5

Open in new window


It works but it is very slow. The field Baustelle is NTEXT-datatype. I tried to create a fulltextindex but this doesn't speed up the query.

is there another way to speed up or do query that data?
Thanks, Peter
0
Comment
Question by:formi
1 Comment
 
LVL 11

Accepted Solution

by:
Louis01 earned 500 total points
ID: 39262180
Try this?

SELECT A.col1
     , A.col2
     , A.col3
     , MAX(Datum) as Datum
  FROM foBaustellen_M1 A 
        LEFT OUTER JOIN foOfferte_M1 B 
    ON B.Baustelle = A.Baustelle 
   AND B.Kundennummer = 5 
 WHERE A.KundenLaufnummer = 5
 GROUP BY A.col1
        , A.col2
        , A.col3

Open in new window

0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question