Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/02/2020 in all areas

  1. That is one of the worse pieces of advice I have seen in these forums for a long time. @Endrick, ignore what @jodunno said in the above quote and specify the columns your query needs - don't use "SELECT * ". One day it will come back to bite you. Consider this scenario... Joe has written a script which creates a register of all student names, and uses "SELECT * FROM student" (with the excuse that he needs all the columns anyway) and iterates through the results. He then takes a holiday and, while he is away, things change. A colleague of his adds a new "dissertation" column and an image BLOB column to the student table. This contains the text of each student's 10,000 word final dissertation and a photo of the student. His register program still works but a query that took milliseconds now takes an age to run. The register doesn't need the dissertation or image data but, nevertheless, is dragging them down from the database for every student.
    1 point
  2. use css but don't ask me why the techies name it text-align instead of content-align or something more inclusive. <style>.image { text-align: center; }</style> <div class="image"> <img src="logo.jpg" alt="John Doe"/> </div>
    1 point
  3. Sure, but how do you connect the invoice to the customer? Again, I assume that your customers can have more than one invoice throughout all of history, so that's the join you need - you need to link customer ID to customer ID between the tables, not customer ID to invoice ID.
    1 point
  4. This is suspect. I assume the 'XXX (FK)' column in your initial post is actually customerId - you'll want to join on that unless your business logic is that each customer can only have one invoice in the system, ever.
    1 point
  5. what have your tried? this assignment seems pretty straight-forward - SELECT the things you want, one of them being the SUM() of the column you want to add up FROM your two tables JOINed together ON the column that relates the data between the tables GROUP BY the column that identifies which rows to SUM() together and any ORDER BY column(s) that get the data into the order that you want to display it as
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.