Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
my dude, if 4 joins in a query is the worst act you have committed, you're doing just fine

Adbot
ADBOT LOVES YOU

Zamujasa
Oct 27, 2010



Bread Liar

Bloody posted:

did write one ugly query that had four joins in it lol

one for each tire

Shaggar
Apr 26, 2006
4 joins is nothing

Bloody
Mar 3, 2013

it felt very tiresome to write but then it turned a lovely pile of hacks that took 30 seconds into a lovely pile of hacks that took 30 milliseconds so i guess it was worthwhile

then i copy-pasted more or less the same query but with trivial differences into like 14 different places in my single database accessing class because literally everything is a lovely pile of hacks

Zamujasa posted:

one for each tire

exactly!!

qhat
Jul 6, 2015


Shaggar posted:

4 joins is nothing

Coffee Jones
Jul 4, 2004

16 bit? Back when we was kids we only got a single bit on Christmas, as a treat
And we had to share it!
n/m

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Bloody posted:

then i copy-pasted more or less the same query but with trivial differences into like 14 different places in my single database accessing class

depending on your database engine and use of this join and attitude, creating a view might be more needs-suiting over the long term than mostly-duplicated query text

Share Bear
Apr 27, 2004

i wrote a union yesterday to collapse two rows with distinct joins and values into a single one and felt like there had to be a better way

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Share Bear posted:

i wrote a union yesterday to collapse two rows with distinct joins and values into a single one and felt like there had to be a better way

what? doesn't a union take two separate queries and give you all the rows from both of them? isn't that the opposite of what you are describing?

or did you do a self-join on an (intermediate query using union) in order to have a single output row with columns from two different input rows?

Sounds like something you could do using just joins, but might have been easier this way because the joinery was already too complicated

Salt Fish
Sep 11, 2003

Cybernetic Crumb

prisoner of waffles posted:

what? doesn't a union take two separate queries and give you all the rows from both of them? isn't that the opposite of what you are describing?

I think they made a list of rows which match either (condition A and condition B) or (condition C and condition D)

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
just 4 joins and no subqueries? this is heaven

skimothy milkerson
Nov 19, 2006

Bloody posted:

btw my database is real and strong and it is my friend :)

fritz
Jul 26, 2003

imagine 4 joins on the edge of a query

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
no where clause? that's madness!

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD
smdh if you use where instead of on

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
i prefer the using clause when possible :shobon:

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

DELETE CASCADE posted:

i prefer the using clause when possible :shobon:

holy poo poo I've always thought that is something which should exist

too bad it's not in t-sql

Adbot
ADBOT LOVES YOU

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

~Coxy posted:

holy poo poo I've always thought that is something which should exist

same

https://twitter.com/symbolicbutt/status/892120929769320450

  • Locked thread