New answers tagged

1

Use set operations. If the user is 42, and the group is 1001, that would be (SELECT user_id_a FROM userfriend WHERE user_id_b = 42 UNION SELECT user_id_b FROM userfriend WHERE user_id_a = 42 ) EXCEPT SELECT user_id FROM usergroup WHERE group_id = 1001; UNION creates a result set that is the union of two query results and removes duplicate rows. ...


0

It is the same SELECT gl.Title, gl.Genre, gl.Plattform, gl.ReleaseDate, gl.Price FROM GameList gl INNER JOIN UserGame ug ON gl.GL_ID = ug.GL_ID WHERE ug.USR_ID = 10; As long you have the User_id you don't need more, but if you also want information from the users table SELECT gl.Title, gl.Genre, gl.Plattform, gl.ReleaseDate, gl.Price FROM GameList gl INNER ...


-1

i needed to do something similar and my brain was not giving, so i searched and found this question ... but then thought of this way also, if username is unique in players ... which in my use fits better (but surely it can be simplified more ?! :) WITH _ AS ( SELECT * FROM players WHERE username = 'foobar' ) , __ AS ( ...


0

You can have SQL that produces create table statement. It can produce inserts, or something. That way, you can move data between different DB systems, and so on.


1

Solved my problem with the following function: CREATE OR REPLACE FUNCTION client_schema.update_geometry_type(my_table text, my_schema text, OUT update_result boolean) LANGUAGE plpgsql AS $function$ declare new_projection varchar(255); declare my_database varchar(255); declare old_projection varchar(255); begin CREATE extension if not EXISTS ...


0

From your question I gathered that Manufacturers, which must have Machines, which must be of certain Models, which Serial Numbers may or may not have been used in Orders from Customers, must be returned in association with said Orders amounts. Based on that, what you need are INNER JOINs between Manufacturers, Machines and Models, being FULL JOINed to Orders....


Top 50 recent answers are included