Jump to content

Complex query help


Go to solution Solved by Barand,

Recommended Posts

Hi

 

I would like some help with this query, the purpose is when someone make an activity , after the date he must define if that activity has been done or not, and i want to put an alert until those fields are registered into the database

The query is this one

SELECT COUNT( * ) AS total
FROM  `nem_pae_atividades` 
WHERE  `idutilizador` =1355
AND  `data` >= CURDATE( ) 
AND  `realizado` IS NULL 
OR LENGTH(  `realizado` ) =0

But i have  always 1 because of the last "and", how can i fix this??

Link to comment
https://forums.phpfreaks.com/topic/298483-complex-query-help/
Share on other sites

Hi Barand

 

Thank you, iv'e tried the way you told me with no success

 

This is what i have in my db

 

plano.png

 

So my point is the make the owner change the field "realizado" if the "data" has been reached

 

My last query was

SELECT COUNT( * ) AS total
FROM  `nem_pae_atividades` 
WHERE (
 `idutilizador` =1355
AND  `data` >= CURDATE( )
)
OR (
 `realizado` IS NULL 
OR LENGTH(  `realizado` )
) =0
Link to comment
https://forums.phpfreaks.com/topic/298483-complex-query-help/#findComment-1522681
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.