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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:30:57+00:00 2026-06-13T10:30:57+00:00

I have 3 tables on my SQLite db as follow: TABLE first_names id name

  • 0

I have 3 tables on my SQLite db as follow:

TABLE first_names

id
name
gender

TABLE last_names

id
name

TABLE names

id
first
last
gender
birthday (null)
used (default 0)

Where first and last are unique and also have a index with both being unique on the names table.

In order to fed names table I have used the below query, which worked the first time but after I had added a new name to the last_names and tried to use it again it failed.

INSERT INTO names (first, last, gender) 
       SELECT f.name AS first, l.name AS last, f.gender AS gender 
              FROM first_names f 
              LEFT JOIN last_names l 
              WHERE f.name NOT IN (SELECT first FROM names) AND 
                    l.name NOT IN (SELECT last FROM names)

Have also tried using (first, last, gender, [birthday], [used]) with values as null AS [birthday], 0 AS [used] but since it birthday is set to null on the table design and used to 0 as default and it worked on the first time didnt think it would be needed nor it made any difference anyway.

I would think it is because of the unique fields however I do have a WHERE to make sure the names are not already in the table names.

I have tried the query using C# and SQLiteAdmin both executing without requesting result or else it doesnt work.

What is wrong with my query and why it only works once ?

  • 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-13T10:30:58+00:00Added an answer on June 13, 2026 at 10:30 am

    Try using:
    WHERE NOT EXISTS ( SELECT * FROM names n WHERE n.first=f.name AND n.last=l.name)

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

Sidebar

Related Questions

In this example we have 3 related tables on a SQLite database: CREATE TABLE
I have two tables. First one: create table history ( id integer primary key,
I have two sqlite tables, where one table has a foreign key of the
Suppose I have an android sqlite table as follows: Students courseID name enrolled final_year
I have two tables in a SQLite DB, and both have the following fields:
My application has multiple SQLite tables(around 20 with different fields). This I have created
I have an SQLite database. I created the tables and filled them with a
So this is what I have, I have a SQLite database with 3 tables:
I have a table in sqlite db called [tblbook] with a column [authors]. What
I have a table in SQLite: CREATE TABLE test_results(timestamp TEXT, npass INTEGER, nfails INTEGER)

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.