Questions tagged [cross-join]

For any question involving a CROSS JOIN, i.e. combining every SELECT-ed field from one table with every SELECT-ed field from another.

Filter by
Sorted by
Tagged with
0 votes
2 answers
333 views

Is it a good idea to join data from two different databases?

I am building an application that requires a lot of tables in one database and while the joining and aggregation of data is really nice and seamless, I am starting to wonder if I am creating too many ...
jaffer_syed's user avatar
0 votes
1 answer
57 views

Is it possible to sort rows by values from generate_series()?

I multiply result rows of a SELECT with CROSS JOIN generate_series(1, max). My query is like: select id, name from person CROSS JOIN generate_series(1, 4) where <condition>; I have this result: ...
nanocellule's user avatar
0 votes
0 answers
51 views

Joining Two Tables via JSONB column (date)

Given the following data: create table datas (id int, data jsonb); insert into categories (id, budget) values (1, '{"2022-07-01": {"budget_amount": value1, "some": &...
RMcLellan's user avatar
2 votes
1 answer
168 views

SQL Server JOIN vs sparse table

I am in the need to query a relation between an entity called article (it's a product sold in a shop) and it's characterstics (a set of attributes). The result will always presented in a paged manner (...
Skary's user avatar
  • 368
0 votes
0 answers
66 views

How to show all the columns data in full outer join

I have 2 tables. The Result is Issue is EnteredBy=23 is not displaying because I am using CT1.EnteredBy. How to display CT11.EnteredBy value instead of NULL The Actual Query I am using is given ...
Diya Rawat's user avatar
0 votes
1 answer
42 views

Using the correct JOIN

I am trying to create an app for the salespeople who work for my company to keep track of their sales/commission When a salesperson brings on an account, their name is noted on the account and the ...
PaulMcF87's user avatar
  • 167
0 votes
1 answer
229 views

Doesn't T-SQL support correlated CROSS JOINs?

This query works SELECT QMC.HAUSKEY, t1.STRNAME, t2.HAUS_NR FROM SWOPS.MIGR.QMCAddresses QMC CROSS JOIN (SELECT STRNAME FROM SWOPS.MIGR.EB_DICT_STREET_QMC WHERE FK=8055909) t1 CROSS JOIN ...
Mediterrano's user avatar
0 votes
0 answers
43 views

Pivot table but with cross product

I' currently in the following situation: I have a measurements table that looks something like this: +----+-----------+-------+---------+ | id | germplasm | trait | m_value | +----+-----------+-------+...
Baz's user avatar
  • 165
0 votes
0 answers
103 views

Is there a cross join in these CTEs?

I have a query that is constructed from several CTEs (in order to organize the query). I constructed it in my SQL workbench and was happy with the test results on a smaller dataset, so I converted it ...
Technaton's user avatar
  • 171
3 votes
1 answer
2k views

How do I create a SQL loop that generates future dates based on different frequencies and intervals for each item until a specified end date?

I have a data set that appears like this: next_generation_date procedure interval frequency 2021-01-17 00:00:00.000 Clean Restroom 1 day 2021-01-17 00:00:00.000 Vacuum 2 week 2021-02-01 00:00:00....
Gulfhawk's user avatar
1 vote
1 answer
79 views

Pairing Query Store Read/Write Status with Enabled Status

I am able to find if Query Store is enabled: SELECT name, is_query_store_on from sys.databases I am able to query a specific database to determine the Query Store Read/Write Status: SELECT ...
CrushingIT's user avatar
5 votes
2 answers
6k views

Is there such a thing as a LEFT CROSS JOIN?

Is there a way to do what I want to call a "LEFT CROSS JOIN"? I.e., is there a way to specify a CROSS JOIN ON, but return at least one row in the result for every row in the left, using ...
Joshua Goldberg's user avatar
0 votes
1 answer
220 views

Add a list of names to a generated series

I generated a date series this way: SELECT generate_series(date '2020-01-01', date '2021-01-21', '1 day'); Additionally I have a list with name (Max Meyer, Anna Smith, Peter Gardner). How could I add ...
wladi's user avatar
  • 1