I have 2 tables in my database, each with an auto-incrementing ID column so that I when I import or export info from the db it will know which rows to pull from. Problem is I can't seem to get it to export data from two different tables at a time, I feel like I'm so close but just not seeing the solution.
Simplified to isolate the specific variables for this task, the two tables look like:
table_a
id_A name
table_b
id_B price
There are 5 entries in each table. All I want to be able to output is a list that:
- orders the prices in table_b from low to high
- then checks the id_B's against id_A's to get the name of the item
- then outputs something simple like...
walmart 5.00
k-mart 4.49
bestbuy 4.25
target 3.99
publix 3.79
...where walmart is the name from table_a and 5.00 is the price from table_b.
Now I know you're probably saying to yourself, "Why don't you just put all the variables in one table?" and the reason is because each table actually has a lot more columns than what I listed, one of them has around 32 columns, but that's not really the problem here so I only listed the important part. Trying to keep everything organized.
Anyone care to explain how to go about doing this? Right now I'm experimenting with nested while loops but it's not coming out how I want it to. Thanks a bunch 🙂