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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:57:05+00:00 2026-06-09T04:57:05+00:00

I need to make somethink like a elecction system so that people at work

  • 0

I need to make somethink like a elecction system so that people at work would select an elecction and select for every person in my DB if he voten or not, and save it to another db table but if i allready selected that a person voted in a election it should not ask me again, but if i select another election it would ask again.
Im using PHP and MySQL for everything.

ive had diferent queries like:

SELECT * 
FROM   personas 
          LEFT OUTER JOIN votaciones 
                 on personas.id = votaciones.id_persona 
WHERE  personas.seccion = 6  AND 
       personas.mesa LIKE 'U' AND 
       votaciones.id_eleccion IS NULL 
LIMIT 5

Currently i have 3 tables. 1 with people in it, its has its id, name, second name, and to which table he went to vote, then another table for all the diferent elecctions, like national elecction of year 2000 and last is the votes that people made.

the last one is Id_person as foreign key from peoples, id_elecction from the elecction, and vote which is 1 or 0 (yes and no).

if it was 1 election it would be easy but with many and i dont know how much becouse you can add more elections in the future.

Thank you in regards to every1 who answers with any answer.

The question: I need to think of a query that would give me names of people that still havent voted for a specific election, like all people that didnt vote in election 1.
And if a person voted in election 1 and still havent voted in election 2. when i ask for election 1 that person would not apear but when i ask for election 2 he would apear as he still havent voted.

something like:

SELECT distinct id, nombre, apellido1,
       apellido2, personas.seccion 
FROM  personas 
        LEFT JOIN votaciones 
             on personas.id = votaciones.id_persona 
WHERE  personas.seccion = 1 AND 
       mesa = 'A' AND 
      (id_eleccion IS NULL OR NOT EXISTS 
                 (SELECT * 
                  FROM votaciones
                  WHERE id_eleccion = 2 )
       ) 
  • 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-09T04:57:07+00:00Added an answer on June 9, 2026 at 4:57 am
        SELECT distinct id,nombre, apellido1,apellido2, personas.seccion from personas
          LEFT JOIN votaciones on personas.id = votaciones.id_persona 
           WHERE personas.seccion = 1 AND mesa = 'A' 
            AND (id_eleccion IS NULL OR id 
             NOT IN (SELECT id FROM personas JOIN votaciones ON personas.id = votaciones.id_persona WHERE id_eleccion =1))
    

    That is the conclusion i came to.

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

Sidebar

Related Questions

So basically I need to make feature that if you select something from first
I need to make something like wp_list_categories that shows categories that are empty but
I need to make something like google-analytics, I mean that it has to be
I need to make something like: Type CustomType = Type.GetType(instanceName); It always returns null.
I need something like make i.e. dependencies + executing shell commands where failing command
I'm playing with GAE, and need to make a query with something like this:
I need to make something(i call it a scheduler) that checks the time of
I'm writing an application using WPF, and I need to make something that looks
I'm looking for a voting system that we can implement at work amongst our
I need to make something like : if isdbnull(value) or value = something then

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.