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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:18:33+00:00 2026-05-31T05:18:33+00:00

I coder for iOS and I use SQLite for my data storage. For now

  • 0

I coder for iOS and I use SQLite for my data storage.

For now i have two tables in my database. This is table_1 and table_2 (it’s easier for understanding)

About struct:

table_1 contain id field (int type) and some_value field (text type)

table_2 contain id field (int type) and table_1_id field (int type)

My question is next: how to select all row from table_1 via array table_1_id field table_2, and this is must SELECT with ORDER BY. I mean order by array.

For example:

if table_2 -> table_1_id contain value 5, 1, 10, 3, 15, 2

the result of output must be in this order.

For now my query is simple:

SELECT * FROM table_1 WHERE id IN (5, 1, 10, 3, 15, 2)

but the select not return order for this query it return data order by 1, 2, 3, 5, 10, 15.

I think I make relation between my table and make SELECT from table_2 uses ORDER BY, but I don’t know how to do this correct.

Thanks in advance!

(Very important for me return this order – 5, 1, 10, 3, 15, 2)

  • 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-31T05:18:34+00:00Added an answer on May 31, 2026 at 5:18 am

    I find some result in stackoverflow

    link

    This is work for me:

    SELECT * FROM “comments” WHERE (“comments”.”id” IN (1,3,2,4)) ORDER
    BY id=1 DESC, ID=3 DESC, id=2 DESC, ID=4 DESC

    This is hard code but I create this query string programmatically in cycle and this work great.

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

Sidebar

Related Questions

I have a video that I play. To use full screen in iOS 3.2
I have a programmatically created Storyboard (as I only use it for iOS 5)
I use until now this code for saving video that i get from UIImagePickerController
I have a bunch of code in an iOS project (named MyLibs) I re-use
I have written a static library to re-use some code between iOS projects, let's
I have recently spotted that it is possible in iOS to use OpenAL to
I'm currently learning to use Core Data on iOS , in my test application
I develop for iOS and use XCode 3.2.5, GCC 4.2. UPD This code works:
I have an iOS app which use the ffmpeg library, and iOS should compile
I just started a new iOS project and chose to use Core Data with

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.