locked
how to perform this task!! RRS feed

  • Question

  • User-2074209654 posted

    Hi, I'm new to mysql..

    i want to create tables such as

    sales

    ---------------------------------

    so_no    name    address

    2013     leoper    new jersey

    2014     roger     atlanta

    ------------------------------------

    another table...

    salesorder

    -------------------------------------------------------------

    serial   so_no  line_item              quantity      rate

    1         2013    dell laptop             1                34000

    2         2013    hp workstation      2                67333

    ---------------------------------------------------------------

    table "sales" will be connected to texdtboxes and "salesorder" will be connected to gridview...

    While entering data, the textboxes will be filled first with so_no and the corresponding line items will be entered in gridview...

    how to create a combination to view the column "so_no" like the following requirement..

    if i select so_no=2013 from "sales"

    dell laptop           

    hp workstation   

    should be displayed

    Tuesday, September 3, 2013 8:13 AM

All replies

  • User1186282158 posted

    Hi LekhaSri,

    You should do this with a SQL query. The query would be like this:

    SELECT line_item FROM salesorder AS a
    INNER JOIN salesorder AS b ON a.so_no = b.so_no
    WHERE b.so_no = 'your value'

    You then replace the 'your value' with what you are searching for. The query above works by turning 'salesorder' into 'a' and 'sales' into 'b' so it is easier to point to. The INNER JOIN part links the tables together using 'so_no'.

    Tuesday, September 3, 2013 8:22 AM
  • User269602965 posted

    i want to create tables such as

    CREATE TABLE SALES
    (
    SO_NO    NUMBER,
    NAME     VARCHAR2(64),
    ADDRESS  VARCHAR2(128)
    );
    
    CREATE TABLE SALES_ORDER
    (
    SERIAL    NUMBER,
    SO_NO     NUMBER,
    LINE_ITEM VARCHAR2(64),
    QUANTITY  NUMBER,
    RATE      NUMBER
    );
    

    Tuesday, September 3, 2013 10:05 AM