0

First, sorry for my english because I'm french

I have two tables : "taches" and "taches_has_sites", and "taches_has_sites" have many of "taches" column but don't care about it, that's normal.

I'm working on a TODO list (list of task), and a task is for every sites. I have a button in all my sites pages for say "ok, I have do this task for this site" and to put the task in the table "taches_has_sites" with the idx_site (ID of the site) and a dt_exe (date of execution)

I need to do a SQL request for take task from the table "taches" :

  • that are not on the table "taches_has_sites"

  • or that are on the table "taches_has_sites" but with a "dt_exe" that is not on his "periodicity"

I'm doing this :

`SELECT t.idx_tache AS 'idx_tache',
t.dt_add AS 'dt_add',
t.dt_maj AS 'dt_maj',
t.dt_delete AS 'dt_delete',
t.titre AS 'titre',
t.description AS 'description',
t.priorite AS 'priorite',
t.periodicite AS 'periodicite'
FROM taches AS t LEFT JOIN taches_has_sites AS ths
ON t.idx_tache = ths.idx_tache
WHERE t.dt_delete IS NULL
AND ths.idx_site = #idx_site#
AND (t.periodicite LIKE 'unique' AND (dt_exe LIKE #date1#)  //unique = ony one time
OR (t.periodicite LIKE 'jour' AND (dt_exe LIKE '%'#dateJ#'%')) //jour= day
OR (t.periodicite LIKE 'semaine' AND (dt_exe LIKE '%'#dateS#'%')) //semaine = week
OR (t.periodicite LIKE 'mois' AND (dt_exe LIKE '%'#dateM#'%')) //mois = month
OR (t.periodicite LIKE 'annee' AND (dt_exe LIKE '%'#dateA#'%')))`//annee = year

With :

$idx_site = The ID of the site
$date1 = "%";
$dateJ = date('Y-m-d');
$dateS = date('Y-W');
$dateM = date('Y-m');
$dateA = date('Y');

but it don't takes my tasks... help me plz

1
  • Not in my case, i'm working with the Prado framework with an SQL Map Commented Jun 24, 2014 at 13:04

1 Answer 1

1

In your query remove the '' from around the % so it would be like '%#date#%' ETC

Sign up to request clarification or add additional context in comments.

1 Comment

Invalid parameter number: number of bound variables does not match number of tokens

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.