# Query problem

**URL:** <https://community.glideapps.com/t/query-problem/70071>\
**Category:** Ask for Help\
**Created:** [January 26, 2024, 2:28pm UTC](https://community.glideapps.com/t/query-problem/70071 "2024-01-26T14:28:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefania\_Oancea](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/stefania_oancea/32/60457_2.png) [@Stefania\_Oancea](https://community.glideapps.com/u/Stefania_Oancea)\
**Post date:** [January 26, 2024, 2:28pm UTC](https://community.glideapps.com/t/query-problem/70071/1 "2024-01-26T14:28:16Z")

</div>

Hello,  
I’m trying to bring the fuel price from the “Preturi combustibil” to the “Registru Productie” according to the last entered date and the car’s registration number. My problem is that the car is not refueled at the gas station every day and when the date is between the 2 refueling (for example the date of 28.01.2024 is between the dates 26.01.2024 and 29.01.2024) it should be filled with the fuel price of the date of 26.01.2024, not with fuel price of the date 29.01.2024.  
In these print screens I tried to do it myself, but it doesn’t work. Does anyone have another idea?

 ![Combustibil1](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/5/e53d18bfd0e39ab485704ee0c48eb20c4bfe9185.png)  
 ![Combustibil](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/c/dcaf94d8ffb463c94fcb4346a450887aa8c7ebdd.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 28, 2024, 8:19am UTC](https://community.glideapps.com/t/query-problem/70071/2 "2024-01-28T08:19:35Z")

</div>

> [@Stefania\_Oancea](#):
>
> I’m trying to bring the fuel price from the “Preturi combustibil” to the “Registru Productie” according to the last entered date and the car’s registration number

Does it mean you need to pull the info from the last line the signed-in user has entered to the “Preturi combustibil” table?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 28, 2024, 8:34am UTC](https://community.glideapps.com/t/query-problem/70071/3 "2024-01-28T08:34:17Z")

</div>

Isn’t this basically the same problem that we already solved below?

> [@Filter data components](https://community.glideapps.com/t/filter-data-components/69893):
>
> Hello, Can someone help me? I want to display the last registration number(Licence plate no.) entered by the driver, but not based on date because Saturday and Sunday the drivers don’t work and I can’t put the condition “Date is within yesterday” in filter data. Only one registration number appears in the print screen because only one is entered.

---

<div class="post-metadata">

**Author:** ![Stefania\_Oancea](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/stefania_oancea/32/60457_2.png) [@Stefania\_Oancea](https://community.glideapps.com/u/Stefania_Oancea)\
**Post date:** [January 29, 2024, 7:29am UTC](https://community.glideapps.com/t/query-problem/70071/4 "2024-01-29T07:29:11Z")

</div>

Well, not really. This time I want that the price to remain unchanged because I want to calculate the total value of the fuel for each day and each car.  
I also used your advice and I thank you for that, but for example I want that the price to be for every day, only on the days when a fuel receipt is not entered to bring me the last price. I think I need to enter something new, but I don’t understand what. I must specify that I do not want this to be set by the user, but automatically when they enter the registration.  
1/25/2024- price 7.80  
1/26/2024-price 7.40  
1/29/2024-price 7.40

 ![Pret combustibil](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/3/430f040c6d34f2a392df7386d0810484655086c8.png)  
 ![pret](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/b/6b24358bcf7efac41bb4854a85e1a7f552682207.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 30, 2024, 12:26am UTC](https://community.glideapps.com/t/query-problem/70071/5 "2024-01-30T00:26:00Z")

</div>

So ultimately, what is the link between your “Preturi combustibil” table and the “Registru Productie” table? Is it a combination of date and license plate? I’m just trying to understand your data’s logic here and what you’re trying to get.

---

<div class="post-metadata">

**Author:** ![Stefania\_Oancea](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/stefania_oancea/32/60457_2.png) [@Stefania\_Oancea](https://community.glideapps.com/u/Stefania_Oancea)\
**Post date:** [January 30, 2024, 7:15am UTC](https://community.glideapps.com/t/query-problem/70071/6 "2024-01-30T07:15:52Z")

</div>

Yes, it is a combination of date and license plate. I try to bring into the “Registru productie” the price of fuel based on date and license plate, but with conditions I mentioned above.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 30, 2024, 12:53pm UTC](https://community.glideapps.com/t/query-problem/70071/7 "2024-01-30T12:53:33Z")

</div>

I think a query with with conditions to match, License Plate is This Row → License Plate l, and Date is on or before This Row → Date, should work. Set the query sorting to sort ascending by date and only return 1 row. Then use a Single Value column to retrieve the fuel price from the query.

---

<div class="post-metadata">

**Author:** ![Stefania\_Oancea](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/stefania_oancea/32/60457_2.png) [@Stefania\_Oancea](https://community.glideapps.com/u/Stefania_Oancea)\
**Post date:** [January 30, 2024, 1:00pm UTC](https://community.glideapps.com/t/query-problem/70071/8 "2024-01-30T13:00:23Z")

</div>

Yes, it worked. Thank you very much!!! 👏 👏 👏

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [February 6, 2024, 1:00pm UTC](https://community.glideapps.com/t/query-problem/70071/9 "2024-02-06T13:00:46Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
