SQL

ndicke20085 Messages postés 3 Statut Membre -  
ndicke20085 Messages postés 3 Statut Membre -
Bonjour tout le monde J'ai un problème qui m empêche de dormir pendant 2 jours et pourtant sa semble être très simple.
Je dois fare une requetes joingant 2 tables

La premiere est la suivante
CREATE TABLE IF NOT EXISTS 'jobs' (
'ID' int(11) NOT NULL AUTO_INCREMENT,
'cust_id' varchar(100) NOT NULL,
'job_id' int(11) NOT NULL,
'job_title' varchar(250) NOT NULL,
'address' text NOT NULL,

et la deuxiemme est la suivante

CREATE TABLE IF NOT EXISTS 'customers' (
'ID' int(11) NOT NULL AUTO_INCREMENT,
'cust_id' varchar(100) NOT NULL,
'cust_name' varchar(250) NOT NULL,
'first_name' varchar(100) NOT NULL,
'last_name' varchar(100) NOT NULL,
'email' varchar(100) NOT NULL,
'password' varchar(40) NOT NULL,

et la requete est la suivante

select first_name,last_name
from customers
JOIN
jobs
ON
where customers.cust_id==jobs.cust_id

and job_title="Bike Wash";

et il me donne cette erreur a chaque fois

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where customers.ID=customers.cust_id and customers.cust_id=jobs.ID ' at line 6

Quelqu un qui peut m aider STP

2 réponses

  1. Profil bloqué
     
    Salut !

    Essaie ça :)

    SELECT first_name,last_name
    FROM customers
    JOIN jobs ON customers.cust_id = jobs.cust_id
    WHERE job_title = "Bike Wash";


    Tu ne peux pas mettre de 'WHERE' après un ON, ça le fait tout seul :)
    0
  2. ndicke20085 Messages postés 3 Statut Membre
     
    Merci sa semble marcher.

    Vraiment je ne saurais vous remercier j'ai vraiment galérer avec
    0