Return query without record in the database

Asked

Viewed 39 times

0

Hello. I have a PHP system with Mysql from a truck fleet company. In this system each user performs a Checklist of the vehicle before using it. This Checklist is registered in a table in the database. My client is asking for a Hecklist query screen that was not performed. Example: it informs the date period and the system returns checklists that were not made in that period.

How will I return a query for something that is not registered in the bank?

1 answer

0


So Eltonrodrigo, first welcome! The simple answer is no. The complete answer is: you probably modeled the bank without making a more accurate analysis of the business rule. In this situation I would have made a registration of Checklist, where I would indicate the vehicle, whether the Checklist was performed or not (a Boolean status field), who performed the Checklist and date of completion of that Checklist. You could get this information by simply filtering checklists with true status.

  • Thank you for the reply Silva Júnior. Yes, I have a table with all vehicles and table with drivers, they are with foreign key to Checklist table. In the table of Checklist also has date of realization. The question is as follows: there is no schedule for the completion of the Checklist and no specific date, any driver can take the vehicle when and where you want.

  • For example, you can search for the date in the Checklist table. Suppose the report is monthly, see how many checklists were made and subtract from 30 or 31, depending on the month. In this case, you would use the SQL COUNT function.

  • You can use your code based on this post; <https://answall.com/questions/322203/selectr-datas-que-n%C3%A3o-est%C3%A3o-na-tabela>

  • It worked! I linked the fleets table with the Checklist table using the left Join as shown in this link of this post you gave me. I had to add a "realized" column of the boolean type and in Select I used the clause WHERE with value "is null". Thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.