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
kalleboo
Jan 13, 2001

Hjälp

Dakha posted:

Yeah, they are just really stupidly named columns. The columns are in several tables im joining, so do I use:

KONP.[/AB/CDE] or [KONP./AB/CDE] ?
The former (if it was the latter it would mean that table names couldn't contain periods).

Adbot
ADBOT LOVES YOU

kalleboo
Jan 13, 2001

Hjälp

mister_gosh posted:

Can anyone help? I'm totally lost.
You need to look into GROUP BY.

kalleboo
Jan 13, 2001

Hjälp

Victor posted:

Is this a single index, or multiple? Indexes can be on multiple columns. In particular, you want an index on (status, DATE).
Even with separate indexes it shouldn't take 4-5 seconds, something must be wrong.

kalleboo
Jan 13, 2001

Hjälp

Victor posted:

Maybe the planets aren't aligned?
Uh oh http://www.pcpro.co.uk/news/153417/solar-flares-threaten-gps.html

kalleboo
Jan 13, 2001

Hjälp

fletcher posted:

edit2: Another PDO question now that I have figured out the error. I want to iterate over every row of a table and update information in another table, like this:

Nobody knows the answer to my question?
Most databases don't let you run queries at the same time, mysql is the exception. Either store the queries you want to run in an array and run them after you've closed the query, or open a second database connection.

kalleboo
Jan 13, 2001

Hjälp

fletcher posted:

The problem is that I need the data from the first query in order to execute the second query. I upped the allowed memory size in php to 256MB and it let me do a fetchAll(), I was just trying to avoid doing that though.
You can store the queries you want to run using the data from the first query in an array, and when the query-building is one, run them after you've closed the query. If there are too many queries to do that, you can open a second database connection to do the insertions. I've used both these methods in C# when I had to work with MSSQL.

kalleboo
Jan 13, 2001

Hjälp

nbv4 posted:

cool that worked. I couldn't get that char() thing to work, so I just used

order by coalesce(manufacturer, 'ZZZZZZZZZZZ')

and it worked fine.
Ångström, or god forbid 甘い贅沢 will break your system ;)

I don't know about other DB systems, but MySQL lets you do

SELECT DISTINCT manufacturer
FROM planes
WHERE pilot_id='5'
ORDER BY manufacturer IS NULL, manufacturer

kalleboo fucked around with this message at 18:12 on Feb 2, 2008

kalleboo
Jan 13, 2001

Hjälp

ray2k posted:

Alright, what's the norm for getting aggregate counts of 1:1 relationships? Like, if I have a Product table with a CategoryId that foreign keys to Category.CategoryId, how would I get the number of Products by CategoryId, including 0's for any CategoryId's not being used by a Product record?
do you mean something like SELECT Category.CategoryId, COUNT(Product.ProductId) FROM Category LEFT JOIN Product ON Product.CategoryId=Category.CategoryId GROUP BY Category.CategoryId or is there some catch in your scenario I'm missing?

kalleboo
Jan 13, 2001

Hjälp

Victor posted:

kalleboo, where did you put the [code][/code] tags?
It was so short and simple I felt like it fit best inline. SA needs more \verb

kalleboo
Jan 13, 2001

Hjälp
php:
<?
SELECT Category.CategoryId, COUNT(Product.ProductId)
FROM Category 
LEFT JOIN Product ON Product.CategoryId=Category.CategoryId
GROUP BY Category.CategoryId?>
Better?

kalleboo
Jan 13, 2001

Hjälp

nbv4 posted:

I am, I just would like one last line of defence against total query entry, just for piece of mind against anything unforeseen... I tried running through each query once with "LIMIT 0" attached, but that didn't work. I'll look into the transaction thing.
This is the whole point of transactions - to be able to roll back changes if anything goes wrong (well, along with making things atomic and the side effect of certain things being optimizable). With MySQL you need to be using InnoDB and a fairly recent version (5.0 IIRC) for support.

kalleboo fucked around with this message at 12:53 on Feb 7, 2008

Adbot
ADBOT LOVES YOU

kalleboo
Jan 13, 2001

Hjälp

da keebsta knicca posted:

I am doing this job search still, but I am having trouble with mysql returning results based on searches with terms like "C++" and "C#". I think it only searches against "C". Is there a way to have it to make sure it searches against the "++" characters also?
Try adding + as a word character: http://dev.mysql.com/doc/refman/5.0/en/fulltext-fine-tuning.html

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