Query last 7 days of data for New York Metro
Now lets say we want to increase the number of price points to include the most recent 7 days. We use the same operator wild card operator from last time ilike
and include a handful of additional fields:
- We want 7 days, so we add the limit operator and set its value to 7
- Since we want the most recent 7 days of data available we order by on
DATE DESC
query priceFeed {
MSA(where: {MSA_NAME: {_ilike: "New%York%"}}) {
MSA_NAME
parcl_price_feed(limit: 7, order_by: {DATE: desc}) {
DATE
PARCL_PRICE_FEED
}
}
}
And these are the results we get:
{
"data": {
"MSA": [
{
"MSA_NAME": "New York-Newark-Jersey City, NY-NJ-PA",
"parcl_price_feed": [
{
"DATE": "2023-01-17",
"PARCL_PRICE_FEED": 336.57861763736224
},
{
"DATE": "2023-01-16",
"PARCL_PRICE_FEED": 335.6524502472524
},
{
"DATE": "2023-01-14",
"PARCL_PRICE_FEED": 335.6627550494502
},
{
"DATE": "2023-01-13",
"PARCL_PRICE_FEED": 335.4273671208787
},
{
"DATE": "2023-01-12",
"PARCL_PRICE_FEED": 335.66926384065897
},
{
"DATE": "2023-01-11",
"PARCL_PRICE_FEED": 335.6870163351645
},
{
"DATE": "2023-01-10",
"PARCL_PRICE_FEED": 335.43190248901067
}
]
}
]
}
}
Updated 15 days ago