We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Anyone good with SQL?
Comments
-
GDB2222 said:Incidentally, I asked ChatGPT your question about the apostophe (what I wrote was just: Fred's Groceries how best to deal with this as the data?) and it suggested:
WHERE LOWER(REPLACE("Description", '''', '')) LIKE '%freds groceries%';
I don't use SQL, but it's pretty obvious that that just changes the description to lower case and replaces the apostophe with nothing.
I'm not sure whether '''' is right, or it needs an extra'?0 -
My computer tells me I am regularly0
-
I think I'll be onboard with AI in general when it can remind me why I went upstairs.4
-
Fred's sounds like Freds does it not?...SOUNDEX......?To cater for all similar text with punctuation by specific code, you will have to use specific code for each possible case.Consider Fred's, Freds, Fred's. Fred's!, Fred"s @Freds Freds_etc.
1 -
GDB2222 said:Incidentally, I asked ChatGPT your question about the apostophe (what I wrote was just: Fred's Groceries how best to deal with this as the data?) and it suggested:
WHERE LOWER(REPLACE("Description", '''', '')) LIKE '%freds groceries%';
I don't use SQL, but it's pretty obvious that that just changes the description to lower case and replaces the apostophe with nothing.
I'm not sure whether '''' is right, or it needs an extra'?WHERE (upper("Description") Like ('%FRED%GROCERIES%'))
would match "Freds Groceries" and "Fred's Groceries" but also "Fred Groceries" and "Fred should really go and buy some Groceries". So simpler (in that it uses fewer functions) but you have to know your data.2 -
teaselMay said:You could always use some regular expressions to ignore the apostrophes if they become a problem
Confucius says: "Man who try to solve problem with regular expression now man with two problems"
Proud member of the wokerati, though I don't eat tofu.Home is where my books are.Solar PV 5.2kWp system, SE facing, >1% shading, installed March 2019.Mortgage free July 20234 -
Old programmer in me is shouting "get the input data validation tightened up".
Makes this type of problem unnecessarily hard if the conditional tests can have any old rubbish thrown at them.2 -
flaneurs_lobster said:Old programmer in me is shouting "get the input data validation tightened up".
Makes this type of problem unnecessarily hard if the conditional tests can have any old rubbish thrown at them.
But anyone who's developed any software knows there is nothing like a user to test it in ways you had never envisaged!I’m a Forum Ambassador and I support the Forum Team on the In My Home MoneySaving, Energy and Techie Stuff boards. If you need any help on these boards, do let me know. Please note that Ambassadors are not moderators. Any posts you spot in breach of the Forum Rules should be reported via the report button, or by emailing forumteam@moneysavingexpert.com.
All views are my own and not the official line of MoneySavingExpert.
3 -
victor2 said:flaneurs_lobster said:Old programmer in me is shouting "get the input data validation tightened up".
Makes this type of problem unnecessarily hard if the conditional tests can have any old rubbish thrown at them.
But anyone who's developed any software knows there is nothing like a user to test it in ways you had never envisaged!1 -
flaneurs_lobster said:Old programmer in me is shouting "get the input data validation tightened up".
Makes this type of problem unnecessarily hard if the conditional tests can have any old rubbish thrown at them.1
Confirm your email address to Create Threads and Reply

Categories
- All Categories
- 350.6K Banking & Borrowing
- 253K Reduce Debt & Boost Income
- 453.4K Spending & Discounts
- 243.6K Work, Benefits & Business
- 598.3K Mortgages, Homes & Bills
- 176.7K Life & Family
- 256.7K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.1K Discuss & Feedback
- 37.6K Read-Only Boards