Solved SQL to append new columns to table

jaryszek

Registered User.
Local time
Today, 15:24
Joined
Aug 25, 2016
Messages
756
Hi Guys,

i have 2 tables:
Table1

IDPetKindColor
1​
CatMammalBlack
2​
DogMammalWhite
and

Table2 Table2

IDFood
1​
Fish
2​
Meet

What i want to do is to get result like here:
ExpectedResult

IDPetKindColorFood
1​
CatMammalBlackFish
4​
CatMammalBlackMeet
5​
DogMammalWhiteFish
6​
DogMammalWhiteMeet
so as you can see for Eech Per and Kind column (co Mammal and Dog and Cat) i just appended one new column = Food.

How can i write SQL to do it?
Best,
Jacek
 

Attachments

Hmm and it is not possible to do this without additional tables only with SQL?

Thanks!

Best,
Jacek
 
Thank you,

let's wait i want to know it :) And will decide.

Best,
Jacek
 
A Cartesian query can produce the output you show (except for the ID field). What purpose do you want this for?

SELECT Table1.*, Table2.Food FROM Table1, Table2;


BTW, correct spelling: "meat", not "meet".
 
Thank you Guys,

i needed cross join here,

Best,
Jacek
 

Users who are viewing this thread

Back
Top Bottom