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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:28:56+00:00 2026-06-13T17:28:56+00:00

I am having an issue with placing the right qoutes in the following sqlite

  • 0

I am having an issue with placing the right qoutes in the following sqlite statement , which places the customer id(c_id) , a primary key of customers table , into the foreign key c_id of place table.

I could extract the c_id by un-nesting the code , and executing the portion ‘select c_id from customers where fname =?” separately . However I want more conciseness in my code .

t = (fname,)
place = (postal_code , place_name)
cur.execute(""insert into place(postal_code ,place_name,c_id) values(?,?,("select c_id from customers where fname =?"),t)""",place)

The quotes are all out of place , help is appreciated for a fix .

Btw: This question is a similar duplicate of this question Insert Data Into Tables Linked by Foreign Key , from which I copied the idea of nesting .

  • 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-13T17:28:58+00:00Added an answer on June 13, 2026 at 5:28 pm

    The solution for this problem lies not in putting the right amount of quotation but in the form of the sqlite statement .

    One solution is to design the variable place with three values, one of them with the foreign key of the customer id(c_id)

    place = (postal_code , place , f_name) 
    
    cur.execute("insert into place(postal_code ,place,f_name) values(?,?,(select c_id from customers where fname =?))",place)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having an issue with a salesforce login on our site. When the customer fills
I'm having an issue with the following situation. User visits site User clicks link
Having issue with slider navigation. Works perfectly fine when there are no other unordered
I having issue that content assistant / intellisense is working in methods such as
Hi guys I am having issue I have this query: SELECT * FROM useraccount
i am having issue with loading my selector via a jquery ajax load call
Just started mongo and started having issue with querying already. i have a collection
Having an issue resizing the #main_wrap on: http://www.coffeeproteindrink.com/method-athlete/ #main_wrap { min-height: 100%; background: url(images/content_back.png)
Having an issue with random individuals trying to access an intranet site with a
Having an issue here that I have tried everything I can think of but

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.