joining two tables
-
i want to join two tables(Firms and People) to show them in datagridview with ascending order in my program side but the thing is that they dont have any common point.so can i join them ?
Sure you can, for instance :
select firms.nmbr as nmbr, firms.name as name, "firm" as type from firms
UNION
select people.id as nmbr, people.surname as name, "people" as type from people;The UNION keyword joins the two result sets. Cheers
I don't like my signature at all
-
Sure you can, for instance :
select firms.nmbr as nmbr, firms.name as name, "firm" as type from firms
UNION
select people.id as nmbr, people.surname as name, "people" as type from people;The UNION keyword joins the two result sets. Cheers
I don't like my signature at all
yeah it worked..thanks Estys..one more question it showed the datas as ordered already actually i wished that so it works always like that or i am lucky :)
-
yeah it worked..thanks Estys..one more question it showed the datas as ordered already actually i wished that so it works always like that or i am lucky :)
-
Without seeing your query, I think that's just blind chance :-D . Cheers
I don't like my signature at all
my query is here
select firma_adi[Kişi/Firma],telefon1[Telefon No],telefon2[Telefon No],Telefon3[Telefon No],Telefon4[Telefon No],Telefon5[Telefon No] from Firmalar
Union
select kisi[Kişi/Firma],numara1[Telefon No],numara2[Telefon No],numara3[Telefon No],Numara4[Telefon No],Numara5[Telefon No] from Rehber -
my query is here
select firma_adi[Kişi/Firma],telefon1[Telefon No],telefon2[Telefon No],Telefon3[Telefon No],Telefon4[Telefon No],Telefon5[Telefon No] from Firmalar
Union
select kisi[Kişi/Firma],numara1[Telefon No],numara2[Telefon No],numara3[Telefon No],Numara4[Telefon No],Numara5[Telefon No] from RehberYou can order the data with the ORDER BY clause. If all select statements use the same fieldnames you can use "ORDER BY <fieldname>", otherwise you can use the form "ORDER BY 2" where the "2" is the position of the field. Cheers
I don't like my signature at all
-
You can order the data with the ORDER BY clause. If all select statements use the same fieldnames you can use "ORDER BY <fieldname>", otherwise you can use the form "ORDER BY 2" where the "2" is the position of the field. Cheers
I don't like my signature at all
yeah it works with order too..thanks for your time