I have a two tables
Users
- ID
Preferences
- ID
- Name
- Value
There are no values between the two tables that can be joined on.
If I have two users and two preferences is there a way to get the following in a single SQL SELECT statement to get the following result:
User1.ID, Preference1.Name, Preference1.Value
User1.ID, Preference2.Name, Preference2.Value
User2.ID, Preference1.Name, Preference1.Value
User2.ID, Preference2.Name, Preference2.Value
Basically I would like to make a UserPreferences SQL View where every user is assigned every preference.
Use a cross join to create a cartesian product:
select u.id, p.name, p.value
from users u cross join preferences p
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With