Hi there,
Thanks for your reply,
I haven't explained this very well, I aim to generate a report which combines totals from the shopOrder and wholesaleOrder tables by date, for a given date span. I can achieve this with nested queries and php loops, although I would be interested to know whether this could be done with a single query.
Here is a screenshot of the intended output:
Report Screenshot...
User Profile
Collapse
-
Query help - Join on date, group by date
Hi there,
I have 2 tables, shopOrder and wholesaleOrder, each have the following structure:
I want to generate a report with the following structure, between two given dates:Code:[U]orderID[/U], orderDate, orderTotal
Currently, my query only returns order data from the shopOrder table if...Code:Date, Number of Wholesale Orders, Wholesale Orders Total, Number of Shop Orders, Shop Orders Total
-
I've got the function working with 2 queries, the first checks for a postage rate for the entire range, the second checks for a postage rate for the specific product and overwrites the value if that is true. Could these queries be combined?
Hope this makes my question clearer :)
[PHP]
function getitemPostage( $it) { // look up item, price, etc.
connect();
$postagePrice = 0.00;
...Leave a comment:
-
Hi there,
Try replacing 'delete' with 'delete[]' as the name to post checkbox values as an array, eg:
[CODE=php]
<input name="delete[]" type="checkbox" id="delete" value="<?php print $rows['id']; ?>" />
[/CODE]...Leave a comment:
-
Help With Query Join Types For Shipping Rates
Hi there,
I'm writing a very simple shopping cart for a friend, but I'm confusing myself with the SQL required to return postage costs for each product in the cart, at checkout.
It's probably best to show you my tables first, each postage rate can apply to multiple products, product ranges, and countries. For example, postage rate X could be $80 postage to USA, France, Germany for all products within ranges 1,2,3 and... -
This didn't solve the problem of returning all rows from Product table, although the guide below helped me write the correct query in the end:
SQL Group By Techniques
My final query:
[CODE=mysql]
SELECT P.productName, P.id, SW.wholesaleUni ts, SW.wholesaleOrd ers
FROM Product P
LEFT JOIN
(SELECT productID, SUM(quantity) as wholesaleUnits, COUNT(Invoice.i d) AS wholesaleOrders...Leave a comment:
-
Thanks pbmods,
That cleared a few things up> You're right - I missed out the Products table, your solution is great but I was trying to list all products from the products table regardless of whether they are related to any Invoice_Item records. So you'd have a complete 'stock list' with sales totals for each product alongside, even if a product's sales total is 0. Could you give any further assistance? Many thanks for your help...Leave a comment:
-
At a glance, your javascript uses the getElementById method, but your form inputs do not have id's. Make sure that any elements used with this method have an id, for example:
[code=html]
<INPUT type=hidden name="selCount" id="selCount" />
<SELECT name="selCountr y" id="selCountry " onChange="ajaxF unction();"/>[/code]Leave a comment:
-
ajcolburn started a topic Selecting all records from a join, even when the value of one table is nullin MySQLSelecting all records from a join, even when the value of one table is null
Hi there,
I've been struggling with a query for a while now, and would be grateful if anyone here could help. The database is for an invoicing system, with the following tables & fields involved in said query:
Invoice (id, orderDate)
Product (id, productName)
Invoice_Item (id, invoice_id, product_id, quantity)
Basically, I've been trying to write some SQL which returns a list of all products... -
Aparna, thanks so much for that, I wasn't expecting such a quick and straight-forward response!
Kind regards,
Alex.Leave a comment:
-
How can I list the MM/DD/YY for the next 4 Thursdays?
Hi there,
I'm fairly new to PHP and can't work out how to do this:
I'd like to list the short date of the next 4 'thursdays' in a drop-down menu, e.g.
The date today is 01/02/2007 so ideally the drop down would contain the following options:
01/04/2007
01/11/2007
01/18/2007
01/25/2007
There must be a simple solution!
Many thanks for any help or hints in advance,...
No activity results to display
Show More
Leave a comment: