Fulltext index query - illogical [closed] - sql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a fulltext index on my table but am getting weird results...
Think a table of current Toys... (huggle buddy is "hot" apparently at the moment)
If a I search for Huggle on my table the results brought up are "Huggle Buddy" toys and I get 12 results...thats fine, perfect.
But if I search for "Huggle Buddy" I get almost 500 results, which is ok as i know its searching both words and combinations, but, the items with Huggle Buddy in the title do not appear first, how do i fix that? e.g. Is there an order by scoring?

Put the search term in quotes so it will only search for an exact match. You'll only get results that contain the exact match "Huggle Buddy".

Related

How to you use Max and Min expression in Ms Access SQL? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
CrimeData Table for 12 months
Crime Took place in Easternmost
I need to find the following:
Q.7 What type of Crime takes place in the …
(a) Easternmost ………………..
(b) Westernmost ………………..
(c) Northernmost………………..
(d) Southernmost………………..
I tried to find the crime took place in the Easternmost using the following SQL code
SELECT Max(CrimeData.Easting) AS MaxOfEasting, CrimeData.Type
FROM CrimeData
GROUP BY CrimeData.Type;
but I got more than one crime and also other Easting numbers. Can you please tell me if there are other good ways to find the solution.
Please see the attached pictures :)
Rather than using Max/Min, have a look at the TOP keyword in SQL. Some SQL might look like:
SELECT TOP 1 CD.*
FROM CrimeData CD
ORDER BY CD.Easting DESC;
Regards,

regular expression for double consonants [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have a problem writing regular expression. I want to write a regular expression that replaces all double consonants with a single consonant.
Please help me to write such a rule in only one line.
Thanks in advance.
Here's a .NET regex that'll find any group of exactly two non-vowels:
[^aeiou]{2}
The following will work for groups longer than 2:
[^aeiou]{2,}
For example, this will match "llst" in "allstar."
Slightly uglier, but will match groups of 2 consonants, case-insensitive:
[QqWwRrTtYyPpSsDdFfGgHhJjKkLlZzXxCcVvBbNnMM]{2}
The following will match two identical non-vowels:
([^aeiou])\1
For example, this would match the "ll" in "all."
Once you have your regex, just use your chosen language's Regex.Replace function.
Since you did not specify the language, I'm going to go ahead and assume Javascript.
This should get you started:
console.log('babble bubble http htttp www'.replace(/([^aeiou\.,\/=?:\d&\s!##$%^*();\\|<>"'_+-])\1{1}/gi, "$1"));
See more here:
http://regexr.com/3ee47

How do I show ☺♦♦ characters in SQL Server? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
You can I display special Unicode characters in my result set on my SQL Server?
e.g. How can i display those characters ☺♦♦?
Well due to the fact that your question is very unspecific here are some solutions.
You need to specify a string as unicode string. This can be achieved by adding an N in front of the string. See example:
SELECT N'☺♦♦' as a, '☺♦♦' as b
Result:
a b
---- ----
☺♦♦ ???
If you want to store those symbols, you need a type as nvarchar or nchar.
Hopefully this helps you.

Wrong Number of Arguments Used With Function in Query Expression [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have an SQL in Access 2010 that was written by someone else that gives a Wrong Number of Arguments error when I try and run it. It's supposed to filter a report from a search page.
SELECT Activity.[ProjNo], Activity.[Code], Activity.[Type], Activity.[ProjNoStatus],
Activity.[Preliminary], Activity.[Planner], Activity.[Designer],
Activity.[Officer], Activity.[Manager], Activity.[Staff], Activity.[Analyst],
Activity.[Manager], Activity.[DeptHead], Activity.[ContractNumber],
Activity.[InfoOfficer],Activity.[ProjNoDesigner]
FROM Activity
WHERE Activity.ProjNo=Index.ProjNo AND (((IIf([Forms]![SearchForm]![txtCode]="",
"*",[Activity].[Code]=[Forms]![SearchForm]![txtCode]))<>False)
AND ((IIf([Forms]![SearchForm]![txtType]="","*",[Activity].[ Type]="",
"*", [Activity].[Type]=[Forms]![SearchForm]![txtType]))<>False) AND
((IIf([Forms]![SearchForm]![txtProjNoStatus]="","*",
[Activity].[ProjNoStatus]<=[Forms]![SearchForm]![txtProjNoStatus]))<>False));
I'm not very experienced with SQL and, like I said, I didn't write this code (the person who did has long since retired) so any help would be great.
That query defines just one data source (table or query):
FROM Activity
But then the WHERE clause appears to reference another data source named Index:
WHERE Activity.ProjNo=Index.ProjNo
Since Index is not included in the FROM clause, Access will object when you try to use it in the WHERE clause.
However, I'm not sure that is the cause of the first error Access complains about. It may help to show us the full text of that error message.

Why does WordPress prefix its column names with the table name? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed last year.
Improve this question
I noticed that in a recent update WordPress decided to change all of its column names to include the table name prefix. WHY?!
The wp_posts table now has a column called post_title, for example. It used to just be title. I don't understand the reason for this change. There must've been one, yes?
I just don't understand what possible reason there could be since in SQL you can refer to things like table.column. Also, it must've been really difficult to change all of the code.
Perhaps to prevent confusion when making joins with tables having similar column names.
There is no good reason for doing this, plus it makes maintenance much more difficult.
There is no confusion if columns are specified like:
SELECT p.title, s.title FROM wp_posts p JOIN site s ON (p.site_id = s.id);