Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
SQL query comparing data in two tables

So I'm still very new to databases. I have a table called patappts, where the name of the hygienist that will be serving the patient for each appointment is stored, among other things. When a user clicks on a date to sign up for an appointment it sends the start time of the appointment that was clicked through to my php file. What I'm trying to do is get the names of all my hygienists in my hygienists table that are not already in my patappts table with the same start time as the one that the user clicked. Therefore only showing the names of the hygienist's that don't already have an appointment at that time.

Not quite sure what to use in my query to achieve this.

$sql = "SELECT hyg FROM patappts WHERE start != '$start' UNION SELECT name FROM hygienists";
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Assuming that you have a hygenists table which contains the list of all the hygenists, I think the query you should use is

SELECT h.name
FROM hygenists h
WHERE h.name NOT IN (
    SELECT p.name
    FROM patappts p
)

This way you will select only those names who do not appear in the appointments list.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda