(This project is all written in JS)
So, I have a table called paid_offers, and two columns called offer_id and entity_id
What I’m trying to do is get a count of all the offer_id values associated with a single entity_id.
EDIT: Example: entity_id A has 35 offers available (so, there are 35 rows with unique offer_ids, but all the same entity_id)
So, getting the count is no problem with arrayList.length, but I just need an approach to getting the actual array. Thanks for the help!
EDIT: As per request, more information! I’m going to be using the output as an array.
So, this project is written using Titanium (From appcelerator). I don’t need anything besides the query. So, It’d be what’s inside the quotes here, for those who don’t know.
var offersList = db.execute("SELECT entity_id FROM paid_offers");
Now, the goal is not to just get the list of ID’s but instead the list of offer_id values associated with each unique entity_id value. I would think it would look close to:
var offersList = db.execute("SELECT offer_id FROM paid_offers WHERE entity_id = entity_id
Except that wouldn’t work, but that’s my train of thought while looking through this.
If you’re trying to count the offers for each entity, it’s
This will only find entities with at least one offer.