How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • Go back-and-forth until satisfied
    Rate the answer you receive.
Ask Su-ada M Your Own Question
Su-ada M
Su-ada M, Programmer
Category: Programming
Satisfied Customers: 58
Experience:  Expert
108794949
Type Your Programming Question Here...
Su-ada M is online now

I have 10 tables that have all the same fields in. These

Customer Question

HiI have 10 tables that have all the same fields in. These are :LeadID|customernumber|salevalue|MarketingcodeEach table is named: custom_1 up to custom_10I then have a master_table that has the below fields in:LeadID|Eventdate|Status|ListIDThe leadID is the key that will link the custom_ tables to the master table.The listID in the master table is the number of the custom table (i.e customer_2 etc )I am just learning PHP and cannot work out how to take the leadid and pull back all data linked to that leadid in all of the custom tables to then perform the calculations I need.I want to end up with an output that gives me by date or date range:Date| Marketingcode| Count of sales | sum of salevalueI could just do a union all on the custom tables but my understanding is in php that’s isn’t needed as you can create a query that will loop through all the different tables instead.Would be extremely grateful for any help you can give.
Submitted: 1 year ago.
Category: Programming
Expert:  Virtual-mod replied 1 year ago.
Hello,

I've been working hard to find a Professional to assist you with your question, but sometimes finding the right Professional can take a little longer than expected.

I wonder whether you're ok with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, feel free to let me know and I will cancel this question for you.

Thank you!
Customer: replied 1 year ago.
ok thanks. happy to wait.
Expert:  Su-ada M replied 1 year ago.

Hello and welcome to JustAnswer.

My name is ***** ***** i look forward to assist you today with your question and provide the best solution possible. I'm sorry to hear you're having trouble with your query. I know that can be frustrating. Hopefully, we can get this resolved quickly.

If you get an offer for a premium service please ignore that for the moment. That offer is automatically generated by this website.

May I know if you are trying to build an SQL Query?

Expert:  Su-ada M replied 1 year ago.

You can use 1 custom table and incorporate all customer details rather than 10.and If you need that can refer to a customer master also. Database normalization suggests to minimize the redundancy.

In that case, simple join in SQL query would do the job.