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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:49:55+00:00 2026-06-12T11:49:55+00:00

As my application is expanding, I now am changing the structure of my database;

  • 0

As my application is expanding, I now am changing the structure of my database; I now want to control file types within the database. I wanted to start with the current file types already in the database. My Database now has a [simplified] 2 table structure like:

tbFiles: pkFileID, fileType, fileName

tblFileType: pkFileType, typeName, typeDesc

I am trying to have the output of a SELECT query update into the newly created tblFileType table. I have tried among other things:

UPDATE tblFileType
INNER JOIN
(SELECT DISTINCT fileType FROM tblFiles) as X
SET typeName = fileType

but I always seem to get 0 row(s) affected.

When I run

SELECT DISTINCT fileType
FROM  `tblFiles`

I get Showing rows 0 - 22 (~23 total, Query took 0.0074 sec)

I know this must be simple, but why is the UPDATE query not affecting 23 rows?

  • 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-12T11:49:56+00:00Added an answer on June 12, 2026 at 11:49 am

    You need to add a JOIN condition like ON t1.fileType = x.fileType as follows:

    UPDATE tblFileType t1
    INNER JOIN
    (
        SELECT DISTINCT fileType 
        FROM tblFiles
    )as X ON t1.fileType = x.fileType
    SET t1.typeName = X.fileType
    

    Update: Since the table tblFileType is blank, you will need to use INSERT something like:

    INSERT INTO tblFileType(typeName )
    SELECT DISTINCT fileType 
    FROM tblFiles
    WHERE -- a condition here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Application is running in my local system app.config file <add key=dbconn value=Data Source=(local);database=VTech;User ID=sa;Password=sa;
I have a working web application that uses username/password SpringSecurity configuration. Now I want
In my application I have a UILabel that holds an expanding number of entries
Application launch through Java web start(JWS) checks for update when we are launching it.
I am expanding/converting a legacy Web Forms application into a totally new MVC application.
Hi i am developing a webbased ftp client application i want to get client
I'm working with an application using Apache XMLBeans (interfaces for XML structure elements extending
I have written a customized Database Adapter extending Mysql Adapter (Zend_Db_Adapter_Mysqli) and my application.ini
I have a Java Swing application. I want to upload information to a web
I am expanding my application with a neat delete all-function in my Preferences. What

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.