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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:14:39+00:00 2026-05-24T23:14:39+00:00

I have a mysql table called jos_users_quizzes with the following columns: id quiz_i duser_id

  • 0

I have a mysql table called

jos_users_quizzes with the following columns:

id
quiz_i
duser_id

I have a second table called  jos_users with this columns
id
name
username
department

the user_id on first table is linked with the id of second table so quiz_id = id (jos_users)
How can build a query to multiple insert the ids of a selected department into the jos_users_quizzes table… IN ONE CLICK

I am thinking a sub query or a loop will do , but no sure how to contruct the query.
I need to select all user ids from selected department. For example have a list of departments, and once the department is selected , select all ids pertaining that department and insert all the Ids into the other table (quizid , (alldepartment ids)

Thanks in advance!

Code from and ASP.NET form to insert ….

  string quizidselected = DropDownList1.SelectedValue;
            string deptselected = ListBox2.SelectedValue;
            //OdbcCommand cmd = new OdbcCommand("INSERT INTO jos_jquarks_users_quizzes  (quiz_id,user_id) VALUES (' " + quizidselected + " ',677)");
            OdbcCommand cmd = new OdbcCommand("INSERT INTO jos_jquarks_users_quizzes (user_id, quiz_id)    SELECT id, ' " + quizidselected + " ' FROM jos_users  WHERE department = ' " + deptselected + " '"); 
  • 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-24T23:14:39+00:00Added an answer on May 24, 2026 at 11:14 pm

    Based on my interpretation of what you want…

    INSERT INTO jos_users_quizzes (user_id, quiz_id)
        SELECT id, :new_quiz_id
            FROM jos_users
            WHERE department = :department
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql table called RATING with this structure: ID, USERNAME, RATING, RATER,
I have a mySQL table called clients with this structure: Name | Phone |
I have a mysql database table called character with columns like name, strength, intelligence,
I have a mysql table called users with the following fields: username - password
I have a MySQL table called accounts . Within this table is a field
I have this mysql table called comments which looks like this: commentID parentID type
I have a MySQL database table called Participant that looks something like this: (idParticipant)
Suppose I have a MySQL table called MyTable, that looks like this: +----+------+-------+ |
Here's the scenario.... I have a MySQL table (called fixtures) with the following.... You
I have one MySQL table, users , with the following columns: user_id (PK) email

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.