# \[APP\]\[PRO\] MySQL-Client

**URL:** <https://community.homey.app/t/app-pro-mysql-client/62459>\
**Category:** Apps\
**Tags:** app, tools, homey-pro\
**Created:** [April 7, 2022, 7:18pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459 "2022-04-07T19:18:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 7, 2022, 7:19pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/2 "2022-04-07T19:19:02Z")

</div>

**Examples:**

- **SELECT**  
Select one value from your database in the THEN part of your flow:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/1/c1eac31cc13ac3ca5ae6f98a6c9417d6d26187ba.png)  
Use the flow trigger in the IF part of your flow to receive the first value of the result.  
You can use the Query-ID used in the SELECT above to filter your flow (react only on this kind of query).  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/4/a4a6a8414da6c56b6a40ff59e7fa5b0e37224f89.png)  
Use the value in your flow. Take a look at the local flow tags you can use:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/3/93eda918c4d1bc8f95fd2efa6603ef1b5f87e25b.png)  
Use the first valus as number or text, write the complete JSON result to the timeline or what ever you need 🙂

* * *

- **INSERT / UPDATE**  
Insert a line into your database. This way you can periodically log capabilities.  
Use a trigger to execute the query:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/b/fbbaf3a906d99101a39e6ebc4c37299384fc4196.png)  
Insert your query and use global tokens or the date variable. This way it’s possible to log a daily sum at a new day using the date of yesterday:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/9/9936f9aa5d9db368d72dd6b16a0f78b1b0676f5f.png)  
If needed you can print your result in the timeline:  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/c/6c95885a76de0df2956544351ea64da3c781b50e.png)

* * *

- **Combining SELECT & INSERT**  
If you have only a meter capability and want to log the hourly usage, you can first select the last meter value from your database and insert a new line with meter and calculated usage value.  
1st: SELECT the last value.  
Start the flow every hour. Set a Query ID to be able to react in a trigger only on that selection. Read the newest value from meter column.  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/9/e9f62f4ca1fe74a728d7377710c07776f4a5d8b1.png)  
2nd: Use this value in a second flow to insert a new line:  
Use the Query ID as filter for the flow trigger. Insert a line with date/time, the calculated difference (current meter minus flow token containing the result of your SELECT) and the new meter value.  
 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/5/75d174467e1e6682e13581857ea490d18111e291.png)

---

_[View the full topic](https://community.homey.app/t/app-pro-mysql-client/62459)._
