Click here to Skip to main content
15,886,067 members

Comments by CPuser2020 (Top 5 by date)

CPuser2020 8-Apr-20 10:37am View    
Hi the above takes a few seconds to run in the sql server manager but takes ages when running from app calling the stored procedure using sqladapter. I've read that this be because of the sub queires. Just wondering is there a better solutiton?
CPuser2020 8-Apr-20 7:30am View    
Hi Richard, I've sorted it by splitting the the where:
select distinct * from authorise where UID IN (
select top 1 UID from authorise where NOT EXISTS (SELECT *
FROM trained
WHERE authorise.name = trained.name AND
authorise.accountnumber = trained.accountnumber) and frequency = 1 order by UID) AND AccountNumber IN(
select top 1 ACCOUNTNUMBER from authorise where NOT EXISTS (SELECT *
FROM trained
WHERE authorise.name = trained.name AND
authorise.accountnumber = trained.accountnumber) and frequency = 1 order by UID)


CPuser2020 5-Apr-20 16:46pm View    
Hi Maciej, I'm only getting a chance to try this now. It works, thanks very much for your help, much appreciated
CPuser2020 5-Apr-20 8:06am View    
Hi Maciej, thanks very much. Although it works for 'This is a sentence' it still doesnt answer my question the way it needs to. I need it to take in various strings from the column 'Name' in the table 'Account'. 'This is a sentence' was given as an example of how I need the strings to look. The solution I added in my question also gave the desired output but doesnt take in the column and thats why I posted it here. Thanks for the article, I had previusly read this
CPuser2020 5-Apr-20 7:18am View    
Hi Maciej, thanks very much for your help. I am trying to create it as a function so that I can pass in the column 'Name' and it would do the above to each row. I am trying to change your answer around to do this but it is giving me erros that I cannot return a select statement from a function