Sometimes I miss having powers... Oh. Oh! I know what this is! This is peer pressure! Any second now you're gonna make me smoke tobacco and--and have drugs!

Anya ,'Showtime'


Buffistechnology 3: "Press Some Buttons, See What Happens."

Got a question about technology? Ask it here. Discussion of hardware, software, TiVos, multi-region DVDs, Windows, Macs, LINUX, hand-helds, iPods, anything tech related. Better than any helpdesk!


tommyrot - Jun 04, 2009 11:29:12 am PDT #10296 of 25501
Sir, it's not an offence to let your cat eat your bacon. Okay? And we don't arrest cats, I'm very sorry.

I'm confused.

Do you want the highest salary of each department, but only if the maximum salary for that department is > 50,000?


§ ita § - Jun 04, 2009 11:35:26 am PDT #10297 of 25501
Well not canonically, no, but this is transformative fiction.

Yes.


tommyrot - Jun 04, 2009 11:38:37 am PDT #10298 of 25501
Sir, it's not an offence to let your cat eat your bacon. Okay? And we don't arrest cats, I'm very sorry.

That's easy. Unless you want the employee number of the highest salary for each department as well. Then you need either a sub-select or the HAVING clause, I think.


§ ita § - Jun 04, 2009 11:39:39 am PDT #10299 of 25501
Well not canonically, no, but this is transformative fiction.

So is my suggestion correct?


tommyrot - Jun 04, 2009 11:45:19 am PDT #10300 of 25501
Sir, it's not an offence to let your cat eat your bacon. Okay? And we don't arrest cats, I'm very sorry.

But you wan the department as well, right? (If it has a top salary > 50k) So it'd be like

SELECT Max(test.salary) AS MaxOfsalary, dept
FROM salary_table
GROUP BY salary_table.dept
HAVING (((Max(salary_table.salary))>50000));

eta: You don't really need the HAVING here. It could just be:

SELECT Max(salary_table.salary) AS MaxOfsalary,
salary_table.dept
FROM salary_table
WHERE (((salary_table.salary)>50000))
GROUP BY salary_table.dept;

eta: I just now noticed one place where I had my test table name instead....


tommyrot - Jun 04, 2009 11:53:36 am PDT #10301 of 25501
Sir, it's not an offence to let your cat eat your bacon. Okay? And we don't arrest cats, I'm very sorry.

ita, your subselect

SELECT salary AS top_salary FROM salary_table GROUP BY department

wouldn't work, as [salary] needs to be part of an aggregate function (MAX, etc.) if you're using a GROUP BY.


§ ita § - Jun 04, 2009 11:54:50 am PDT #10302 of 25501
Well not canonically, no, but this is transformative fiction.

I really overthought that one...

Thanks.


tommyrot - Jun 04, 2009 12:00:31 pm PDT #10303 of 25501
Sir, it's not an offence to let your cat eat your bacon. Okay? And we don't arrest cats, I'm very sorry.

No prob. I was overthinking it too at first. It does get more complex if you need the employee number too....


Dana - Jun 04, 2009 4:05:55 pm PDT #10304 of 25501
I'm terrifically busy with my ennui.

This may be a stupid question, but how hard is it to set up a Wordpress installation on a site?

Aha! Dreamhost does it automatically. Never mind.


Dana - Jun 04, 2009 4:08:43 pm PDT #10305 of 25501
I'm terrifically busy with my ennui.

And on a similar but different note, is there a web design person out here who'd be interested in redesigning a site for me (or my mother's non-profit)? It should be a simple job, and I can pay through PayPal or check or cookies. If so, please e-mail me at my profile address.

Sorted!