sql join queries on combining datas from mutiple tables into single row in vb6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vishal anand
    New Member
    • Sep 2013
    • 7

    sql join queries on combining datas from mutiple tables into single row in vb6

    hI my name is vishal. I building vb6 application with ms access using adodb. I have a form which contains label,combobox and 2 buttons.The form loads required data that I use when combobox is clicked.But given below is line where I am getting errors.
    he query below I take from 4 tables.
    Given below are structure of my 4 tables:
    table1: name:Inward
    Column Name DataType
    mfr_ref_number Text
    no_of_bundle Integer
    supplier_id Integer
    DC_date Date/Time
    INV_date Date/Time
    row_upd_date Date/Time
    courier_name Text
    inward_type Text
    user_id Long(contains values 0 for all)
    DC_NO Text
    closed_status Boolean(true for some agn only)
    to_dept Text
    agn Long

    table2:name:ite m_mater
    Column Name DataType
    user_id Long(contains 0 as value for all)
    row_upd_date Date/Time
    status Boolean
    item_name Text
    item_parent Long
    item_price Double
    item_desc1 Memo
    item_desc2 Memo
    item_desc3 Memo
    item_type Long
    item_code Text
    agn Long
    measure_type Text

    table3:name: Stock_Register
    Column Name DataType
    row_upd_date Date/Time
    technician_id Long
    user_id Long(contains 0 as value for all entries)
    in_out_type Integer
    status Boolean
    item_id Long
    qty_debit Double
    qty_credit Double
    in_out_id Long
    store_no Long
    sl_no Text
    ref_id Long

    table4:name:sto re_master
    ColumnName DataType
    rack_name Text
    rack_desc Memo
    user_id Long(contains 0 as value for all entries)
    row_upd_date Date/Time
    status Boolean
    store_no Long

    However the problem lies in my Sql select query given below:.

    Code:
    SELECT [Inward].[agn], [item_master].[item_name], [Inward].[no_of_bundle], [store_master].[rack_name], [store_master].[store_no]
    FROM (Inward INNER JOIN store_master ON [Inward].[store_no]=[store_master].[store_no]) INNER JOIN item_master ON [store_master].[user_id]=[item_master].[user_id]
    WHERE [item_master].[status]=True And [Inward].[deleted_status]=False And [Inward].[closed_status]=False And [Inward].[agn]<>0 And [store_master].[status]=True;
    I have to show agn field from table named Inward,item_nam e field from table named item_master,no_ of_bundle field from table named Inward,rack_nam e field from table named store_master,st ore_no field from table named store_master. When I tried the above query I get message that datas are not found for any agn. But in fact there are datas for agn I just need to check with another table named Stock_Register. Can Help me or guide me on how to fix the sql select query using joins.I going nuts over solving this query. Can anyone help me please . Any help or guidance in fixing the sql select query would be greatly appreciated.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I don't understand what your question is. Please post some sample data and results.

    Also, what's the point of user id if it's always 0? And why would you join on it if it's always 0? That just joins every record to every record.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32633

      #3
      This is a VB question so I've moved it to the correct forum for you.

      Comment

      Working...