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 7831187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:36:54+00:00 2026-06-02T11:36:54+00:00

I am working on SQLite and I have written a query which returns me

  • 0

I am working on SQLite and I have written a query which returns me two arrays ItemsArray and CustomersIDArray as:

ItemsArray
Element at Index 0 = Off White,
Element at Index 1 = Fan,
Element at Index 2 = Off White,
Element at Index 3 = Delux,
Element at Index 4 = Fan

CustomerIDArray 
Element at Index 0 = 1,
Element at Index 1 = 2,
Element at Index 2 = 2,
Element at Index 3 = 3,
Element at Index 4 = 4

I want result like that Off White = 2 (count) , Fan = 2 (count) and Delux = 1;
and the Resultant Array,

Result Array 
Element at Index 0 = Off White,
Element at Index 1 = Fan,
Element at Index 2 = Delux

Actually I want the count of repetition in first array but the value must not same for CustomerArray.
Please help me through logic or code.

  • 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-06-02T11:36:55+00:00Added an answer on June 2, 2026 at 11:36 am
    -(NSMutableArray *)getCountAndRemoveMultiples:(NSMutableArray *)array{
    
        NSMutableArray *newArray = [[NSMutableArray alloc]initWithArray:(NSArray *)array];
        NSMutableArray *countArray = [NSMutableArray new];
        int countInt = 1;
        for (int i = 0; i < newArray.count; ++i) {
            NSString *string = [newArray objectAtIndex:i];
            for (int j = i+1; j < newArray.count; ++j) {
                if ([string isEqualToString:[newArray objectAtIndex:j]]) {
                    [newArray removeObjectAtIndex:j];
                    countInt++;
                }
            }
            [countArray addObject:[NSNumber numberWithInt:countInt]];
            countInt = 1;
        }
        NSMutableArray *finalArray = [[NSMutableArray alloc] initWithObjects:newArray, countArray, nil];
        NSLog(@"%@", finalArray);
        return finalArray;
    
    }
    - (IBAction)getArrayInfo:(id)sender {
        NSMutableArray *myArray = [[NSMutableArray alloc] initWithObjects:@"Off White", @"Fan", @"Off White", @"Deluxe", @"Fan", nil];
        NSMutableArray *godArray = [self getCountAndRemoveMultiples:myArray];
        NSLog(@"Array from this end = %@", godArray);
    }
    

    I just set up -getArrayInfo to test it out. Works fine. As you can see, the array you want to display will be at index:0, and the countArray at index:1.

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

Sidebar

Related Questions

I am working with SQLite. Suppose I have a table sales with two columns,
I have application working with SQLite DB(table with two rows) I need to recieve
I am working on rails 3 and sqlite db. Using a IN query. Currently
i'm working on an iPhone application which retrieve sqlite database from server through json/rest
I have created a working SQlite database in my application. I can add new
I have 6MB memory leaks when I'm working with sqlite. Now I'm testing getBookWithIdTest
I'm working with sqlite and qt. I understand that sqlite doesn't have native user
I don't have any knowledge on working with Sqlite database on Blackberry. Recently i
I am working on SQLite File Encryption . I have added sqlCipher & crypto
I'm working on my first android app and have an SQLite database set up

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.