Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7644835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:47:07+00:00 2026-05-31T09:47:07+00:00

SELECT iif( LIKE(sol,’EM06%’), other,sol) as solGroup; FROM dpgift GROUP BY solGroup The above should

  • 0
SELECT iif( LIKE(sol,'EM06%'), "other",sol) as solGroup;
    FROM dpgift GROUP BY solGroup

The above should give me a column containing unique sol values. In addition, any sol value starting with EM06 should be grouped into “other”. It doesn’t work though, instead it returns the following.

Solgroup
DM081
EM061
EM081
EM100
EM101
EM105
EM111
TM081

Can anyone see what i’m doing wrong here? the 2nd and 3rd line should be called “other”.

I’ve used this like command many times and it’s never done this before. I can’t see anything wrong with the syntax and I’ve tried other variations without success. I’ve even tried casting in case a certain field type doesn’t work but the result is always the same.

edit: using a ‘*’ and putting the wildcard string as the first parameter works. I’ve actually been making this mistake for a while in the following manner:

iif( (LIKE("4%",sol) OR sol = "4"),"8M","other");

The like does nothing here but i hadn’t noticed since the ‘=’ operator returns true if sol starts with ‘4’ (can someone link me a reference to ‘=’ behavior?). The reason i included the sol = "4" is because i assumed % meant one or more char rather than 0 or more.
Anyway, i’ve gone back and changed all my code to iif(like("wtvr*",string),stringtrue,stringfalse)

I imagine using ‘=’ to compare strings is not recommended since it doesn’t seem to be mentioned in the msdn library.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:47:08+00:00Added an answer on May 31, 2026 at 9:47 am

    another alternative is to use “$”, AT() or ATC()

    “$” means if the left side is found ANYWHERE in the right side…

    iif( “EM06” $ sol, “other”, sol )

    AT() is to compare if a string is found in another, but IS CASE-SENSITIVE, returns the character position found in the string (VFP is 1-based, not zero-based)

    iif( at( “EM06”, sol ) > 0, “other”, sol )

    or

    ATC() — same as AT(), but is NOT case-sensitive.

    If you specifically want the “EM06” to be at the start of the string, you could even just do a LEFT() comparison

    iif( left( sol, 4 ) = “EM06”, “other”, sol )

    or even

    iif( ATC( “EM06”, sol ) = 1, “other”, sol )

    and yes, these are all valid within SQL-Select..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is my query: SELECT IIf([Lab Occurrence Form].[2 0 Analytical (Testing Phase)] Like ‘*2.5*Other*’,’2.5
Here's my query: SELECT solGroup,; SUM(IIF((; SELECT COUNT(*) FROM cgift c2; WHERE c2.solgroup !=
SELECT (SELECT IIF(IsNull(sum(b.AmountCharged) - sum(b.AmountPaid)), a.Balance, (sum(b.AmountCharged) - sum(b.AmountPaid))) FROM tblCurrentTransaction AS b WHERE
SELECT * FROM myTable WHERE field1 LIKE 'match0' AND myfunc(t1.hardwareConfig) LIKE 'match1' Here is
i have a query in access that is this: SELECT iif([Cup Type] like '*Cylinder*',count([Cup
SELECT k.condition, SUM(IIf(AnimalType=3,1,0)) AS Carnivore, SUM(IIf(AnimalType=4,1,0)) as Herbivore From Animals a inner join knownconditions
I'm using the following statement SELECT TOP 5 rootcause, COUNT(IIF(accountability=Team 1,1,0)) FROM MOAQ WHERE
Using SQL Server 2000 My Query. SELECT (Format(IIf(CLng(OutTime) > 180000, CDate('18:00:00'), CDate(Format(OutTime, '00:00:00'))) -
SELECT events.title FROM events ORDER BY events.title DESC I'm getting the proper ordering for
select @result=@input.query('*') for xml raw,type Above statement will generate following alert: Msg 6819, Level

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.