Current Result: ID | Item | Red | Green | Blue | Yellow 03 balloon 1 0 0 0 03 balloon 0 1 0 0 03 balloon 1 0 0 1 24 ribbon …
Tag: join
SQL – Postgres string agg is giving duplicates
Im trying to collect the foreign key mapping from system tables. And I used this below query. query 1: But this won’t provide the Primary tables columns that are pointing as Fk. So I found this query on Stackoverflow. query 2 Now this query gives individual columns. Lets say there is a FK like (logid, i…
Join many to many tables optionally
I have below tables User Intrest Hobby User_Intrest User_Hobby Now to find user ids who have both interests Eating and Sleeping I have written Output Same as above I also can find user ids with hobbies Smoking, Hiking, Browsing as below Output Now I want to mix these two optionally in a way that if only inter…
A problem with a simple join taking too long to finish
I´m having trouble identifying who to fix this simple join. My problem is, after adding the column B.CIDPRODUCT IS NULL this query takes hours to finish. table BO_PRICER001 rows 286537 table BO_PRODUCTCONFIG rows 7934844 on the table BO_PRICER001 exists 15329 rows with null with B.CIDPRODUCT IS NULL the live …
SQL – Add in a new table join when all left join – Total beginner [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I need help with adding in an additional join to my query. All the tables are currently left…
informix 14.10 How to join three table for double mapping
I have 3 tables c1,map1,map2 like this: And the output should be such a table: If it was just table map1, the problem was simple Can anybody help? Answer On the face of it, this should do the job: Tested with this SQL to confirm the result: Output:
Optimal join from a column to the concatenation of those columns?
I have a table TableLHS with a column ObjInfo: which I would like to join to TableRHS, with columns: So the join here involves 1) dropping the leading zeroes from ObjNumber, and 2) concatenating the three columns in TableRHS together. My best shot at the join is: My current performance could use some improvem…
t-SQL cartesian production of several tables
I would like to get a cartesian product of several tables in SQL (which are actually only one column, so no common key). For example: I tried CROSS JOIN, but I couldn’t find an example with multiple tables. Is the only way to do it is nesting? What if we have 15 tables to join that way… it creates…
JOIN multiple tables based on one reference table and count records
I have these following tables: cars: id manufacturer ——————– 1 Nissan 2 Toyota 3 Honda 4 Volkswagen type: id type car_id ————–…
How to to create a new identifier in SQL for related addresses that have multiple relationships?
I have a data set like below that includes address and customer_id. In this example multiple customers can ship to the same address and a customer can ship to multiple addresses. I would like to use the relationships between these to create a new ID that joins all of the related addresses and customer_id̵…