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.
 
  • Post
  • Reply
Senso
Nov 4, 2005

Always working
I'm using MySQL and I've read a lot about the different possible engines but it's still not clear which one is the best since all of them usually claim to be.

Specifically, I'm interested in the differences and pros/cons between MyISAM and Innodb. I think Innodb is better when you have a lot of queries since it does row-level locking but MyISAM seems to have a lot of optimization too.

EDIT: VVVV Yes I did. I was looking for actual experience and opinions from people here, other than posts in other forums or technical whitepapers and benchmarks.

Senso fucked around with this message at 15:28 on Dec 4, 2007

Adbot
ADBOT LOVES YOU

Senso
Nov 4, 2005

Always working
I'm using Oracle to build a query that has me scratching my head. I simply cannot find a way to do the following
in a single big query. I don't really know PL/SQL so I don't want to go that way, if possible.

So here's my example.

Let's say I have a table FOOBAR with data:

code:
foo		bar		fred
1		a		10
2		b		10
3		c		10
4		d		11
5		e		11
6		f		12
7		g		13
8		h		14
9		i		15
10		j		15
I want to have a list of all 'foo' that have a unique 'fred'. Ex. 1 does not match because its 'fred' (10) appears 3 times in that table.

Basically, I have a query like that:

code:
SELECT foo,COUNT(*) FROM foobar
WHERE fred IS NOT NULL 
GROUP BY foo HAVING COUNT(*) = 1;

Which would return:

FOO COUNT(*)
--- --------
6   1
7   1
8   1
The problem is, I want to return ONLY the 'foo' column because I need to pass the results in another 'WHERE x in (...)' query. The COUNT(*) column does not allow me to pass the results.

Any ideas? I don't know PL/SQL but maybe it would be possible to store the first results into an array or something and then loop over that...

Senso
Nov 4, 2005

Always working

yaoi prophet posted:

code:
SELECT * FROM blah WHERE foo IN
(SELECT foo,COUNT(*) FROM foobar
 WHERE fred IS NOT NULL 
 GROUP BY foo HAVING COUNT(*) = 1)

This does not work, I get a "ORA-00913: too many values" error. I'll try to make the second option work and let you know how that goes.

Senso
Nov 4, 2005

Always working
^^^^ That works perfectly, thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply