User Profile

Collapse

Profile Sidebar

Collapse
ajcolburn
ajcolburn
Last Activity: Nov 17 '08, 01:22 PM
Joined: Jan 2 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • ajcolburn
    replied to Query help - Join on date, group by date
    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...
    See more | Go to post

    Leave a comment:


  • ajcolburn
    started a topic Query help - Join on date, group by date

    Query help - Join on date, group by date

    Hi there,

    I have 2 tables, shopOrder and wholesaleOrder, each have the following structure:

    Code:
    [U]orderID[/U], orderDate, orderTotal
    I want to generate a report with the following structure, between two given dates:
    Code:
    Date, Number of Wholesale Orders, Wholesale Orders Total, Number of Shop Orders, Shop Orders Total
    Currently, my query only returns order data from the shopOrder table if...
    See more | Go to post

  • 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;
    ...
    See more | Go to post

    Leave a comment:


  • ajcolburn
    replied to Delete Usings Checkboxes
    in PHP
    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]...
    See more | Go to post

    Leave a comment:


  • ajcolburn
    started a topic Help With Query Join Types For Shipping Rates

    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...
    See more | Go to post

  • 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...
    See more | Go to post

    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...
    See more | Go to post

    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]
    See more | Go to post
    Last edited by pbmods; Oct 7 '07, 01:52 PM. Reason: Added CODE tags.

    Leave a comment:


  • Selecting 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...
    See more | Go to post
    Last edited by pbmods; Oct 7 '07, 01:53 PM. Reason: Changed [CODE] to [CODE=mysql].

  • Aparna, thanks so much for that, I wasn't expecting such a quick and straight-forward response!

    Kind regards,
    Alex.
    See more | Go to post

    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,...
    See more | Go to post
No activity results to display
Show More
Working...