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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:17:44+00:00 2026-06-16T23:17:44+00:00

Need help, please see below table structure: Table: MainData (see fields below) ID TypeId

  • 0

Need help, please see below table structure:

Table: MainData (see fields below)

ID  TypeId  TypeName
0   0   MAIN
1   4   Test1
2   4   Test2
3   4   Test3
4   4   Test4
7   7   File1
8   7   File2
9   7   File3
10  7   File4
14  8   Database1
15  8   Datebase2
16  8   Database3
17  8   Database4

See query below now with which i’m strugling

Insert into temptable (Field1, Field2, Field3) Values (Test1, File4, Database3)

Test1, File4, Database3 – I have got these as string values passed to function, now to have to get their ID’s which need to be insert into temptable

So then below query should become

Insert into temptable (Field1, Field2, Field3) Values (1, 10, 16)

1 - Test1
10 - File4
16 - Database3

Regards

  • 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-16T23:17:46+00:00Added an answer on June 16, 2026 at 11:17 pm
    insert into temptable
        select (select id from Maintable mt where mt.typename = 'test1'),
               (select id from Maintable mt where mt.typename = 'File4'),
               (select id from Maintable mt where mt.typename = 'Database3')
    

    Note: this works only if there is exactly zero or one entries in the Maintable for any given value. You might want to use the typeid, but it is not clear from your question.

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

Sidebar

Related Questions

Please i need help, this code below works fine on my localhost, php5.3+ but
Please, I need help with my code: def start(): def start_tkinter(): global main,l main.destroy()
Please I need your help with grabbing rows from a table and dynamic text
Can some please help how to dynamically generate command object. See below - I
I need a little help here please.What am trying to do is pull all
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
Please help! I need to produce a Crystal Report with multiple data columns, but
please i need you help with my script.. I'm trying to echo some content
Please I need your help with my script. I'm trying to insert values into
Please i need your help with how to include INDEXES in my tables, i've

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.