开发者

help with this search query

It says in phpmyadmin syntax error near 'SELECT c.candidate_id AS candidate_id,c.date_time_stamp AS candidate_date_time,c' at line 1

SELECT * FROM states ORDER BY name ASC 

SELECT c.candidate_id AS candidate_id,
       c.date_time_stamp AS candidate_date_time,
    开发者_如何转开发   c.first_name AS first_name, c.last_name AS last_name,
       c.availability_date AS availability_date,
       c.experience_years AS experience_years,
       c.phone AS phone,c.phone_alternate AS phone_alternate,
       c.email AS email,c.bridge AS bridge,c.hot AS hot,
       c.submitted AS submitted,c.placed AS placed,
       sp.abbreviation AS specialty_abbreviation,
       jt.name AS candidate_job_type,s.first_name AS staff_first_name 
FROM candidates c 
     LEFT JOIN specialties sp ON sp.specialty_id=c.specialty_id 
     LEFT JOIN candidate_job_types jt ON jt.candidate_job_type_id=c.candidate_job_type_id 
     LEFT JOIN staff s ON s.staff_id=c.staff_id 
WHERE c.active=1 AND 
      ( CONCAT_WS(' ', c.first_name, c.last_name) LIKE '%gmail%' OR c.phone = 'gmail'       OR 
      c.phone_alternate = 'gmail' OR c.email = 'gmail') GROUP BY c.candidate_id 
 ORDER BY c.date_time_stamp DESC LIMIT 0,100 


You have errors because of merged two SELECT statements. If you seperate them with ;, it should works.

   SELECT * 
     FROM states
 ORDER BY name ASC;

   SELECT c.candidate_id AS candidate_id,c.date_time_stamp AS candidate_date_time, 
          c.first_name AS first_name, c.last_name AS last_name,
          c.availability_date AS availability_date,
          c.experience_years AS experience_years,c.phone AS phone,
          c.phone_alternate AS phone_alternate,c.email AS email,c.bridge AS bridge,
          c.hot AS hot,c.submitted AS submitted,c.placed AS placed,
          sp.abbreviation AS specialty_abbreviation,jt.name AS candidate_job_type,
          s.first_name AS staff_first_name
     FROM candidates c
LEFT JOIN specialties sp
       ON sp.specialty_id=c.specialty_id
LEFT JOIN candidate_job_types jt
       ON jt.candidate_job_type_id=c.candidate_job_type_id
LEFT JOIN staff s
       ON s.staff_id=c.staff_id
    WHERE c.active=1
      AND ( CONCAT_WS(' ', c.first_name, c.last_name) LIKE '%gmail%'
         OR c.phone = 'gmail'
         OR c.phone_alternate = 'gmail'
         OR c.email = 'gmail'
          )
 GROUP BY c.candidate_id
 ORDER BY c.date_time_stamp DESC
    LIMIT 0,100;


You are executing two select statements together. Use a semi-colon:

SELECT * FROM states ORDER BY name ASC;
SELECT c.candidate_id AS [...]


The problem is just in the beginning: SELECT * FROM states ORDER BY name ASC SELECT c.candidate_id ....

Use Semi-colon to put apart different searches: SELECT * FROM states ORDER BY name ASC; SELECT c.candidate_id...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜