Hi guys, I'm in a bit of a situation here and I was wondering if anybody has any suggestion. Basically, I need to retrieve some data from 2 or perhaps 1 SQL table (that's what I'd like you to help me finding out).
OK, here are my two tables (sure you've seen them already):
expenses table (which is updated by the application):
expensesCode (whose data never change):
Right, so I have to get the data out of the tables. I'd do what I normally do, but here there is a problem: this is how my application for presenting the data looks like:
So I have to determine which expense is what when I retrieve the data because the first table (expenses) contains the relevant numerical data I'm interested in but it has
ints in place of the type of expense. So, how do I proceed? I'd use a normal
SELECT statement to retrieve the data but it's not clear to me how, when and if I should determine what's what (is it a food, car, bill or rent expense?) Do I have to access both tables or is it just a matter of filtering the data in the expenses table, something like "is expensesID value 4? If so it's food so get the cost and display it in the food field"?