hi my name is vishal for past 10 days i have been going nuts on how to combine selected datas from 3 or more tables into single sql select query in vb6.

i have 4 tables named

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 0 as value for all entries)

DC_NO                                text

closed_status                        boolean(true for some agn only)

to_dept                               text

agn                                   long

table2 name: item_master

Column Name                            DataType

user_id                               long(contains 0 as value for all entries)

row_upd_date                          date/time

deleted_status                        boolean(contains false value for all entries)

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: store_master

Column Name                           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

table4 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

deleted_status                             boolean

item_id                                     long

qty_debit                                  double

qty_credit                                  double

in_out_id                                   long

store_no                                    long

ref_id                                      long

sl_no                                       text

what i want is to write a sql select query which would contain agn values from Inward table,item_name values from item_master table,rack_name values from store_master table,store_no values from store_master table and no_of_bundle values from Inward table.

I myself have written sql query using little knowledge of sql queries and i get partial output. Query given below:
select i.no_of_bundle,sm.rack_name,sr.store_no,sr.in_out_type,i.agn,it.item_name from inward i,store_master sm,stock_register sr,item_master it where sm.status=true and sr.in_out_id=i.agn and sr.status=true and sm.store_no=sr.store_no and i.deleted_status=false

i know that i am in correct direction in achieving my required query. I think i must add or modify my sql query in Where clause but dont know how. Can anyone tell me what should be added or modified in my sql query. Can anyone help me please. Any help or guidance in solving getting the required sql query would be greatly appreciated.

3 Years
Discussion Span
Last Post by abelingaw

Well tell me how to use joins in my above query because i tried it before(i have used inner join) and i got error and was unable to fix it so i changed my query to the above query. Reply please how to apply joins correctly in my above query?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.