I'd appreciate if someone could help. I have two tables that have no relationship:
Table_1
ID credittype creditamount date time
------------------------------------
1 abc 10 2016-01-18 11:29:59 am
2 def 20 2016-01-20 4:35:58 pm
3 def 20 2016-01-21 4:35:58 pm
Table_2
ID debitetype debiteamount date time
------------------------------------
1 abc 10 2016-01-18 11:29:59 am
2 def 20 2016-01-19 4:35:58 pm
3 def 20 2016-01-21 4:35:58 pm
i just want to display these tables values like that
credittype creditamount debitetype debiteamount date time
---------------------------------------------------------
abc 10 2016-01-18 11:29:59 am
def 20 2016-01-19 4:35:58 pm
def 20 2016-01-20 4:35:58 pm
i will try this query
select * from Table_1 union select * from Table_2;
i did not get answer any one help me?
Note , joining 2 table that don't have any condition not good , and it discovered that you don't design your database structure very well.
so , try like this :
select tb1.credittype,tb1.creditamount,tb1.debitetype,tb1.debiteamount,tb1.date,tb1.time from table1,table2
it gives you all record in table one and table two
Using union only gets distinct values from both tables. Try using "union all" to return all values. Refer to http://www.w3schools.com/sql/sql_union.asp.