#mysql - Thu 19 Apr 2007 between 00:00 and 00:37

NY Lost Funds



Level9Wizardthanks chadmaynard
SapphLets say a table has two fields, badge_id and badge_type. I want a query that returns two columns: column one is count(badge_id) where badge_typ=1 and column two is count(badge_id) where badge_type=2. I always want both columns.
EdsipeRdo exists some way to disable the 'lock table' feature?
chadmaynardSELECT badge_type, count(0) AS badge_count FROM table WHERE badge_type IN (1,2) GROUP BY badge_type; ?
EdsipeRI don't want to allow the mysql user to lock tables
clever[rev]chadmaynard: ahh nice never seen 'in' used in a where clause before
that looks usefull
SapphThat gives me the counts in 1 column, two rows. I'm trying to get them in 1 row, two columns. I think it may be impossible, but I wanted to ask
chadmaynardyou want count(type1,) count(type2) ?
Sappher, not really. The following is not an attempt at valid syntax, just an attempt to get the idea across. I want COUNT(badge_id WHERE badge_type=1), COUNT(badge_id WHERE badge_id=2)
chadmaynardhaha i can't think of a good way to do that
SapphYeah, me neither. I don't think its possible. I was trying to avoid seperate queries, since I really don't need two columns, I need 8. Per unit. With some pages displaying as many as 60 someodd units. That's 500 queries per page.
chadmaynardit is possible...
the group by with a row per type is your best bet
another way is to use user vars
and a CASE statement
EdsipeRhow can I dump a database without LOCK Tables statement ?
arjenAUEdsipeR: innodb tables can be done with --single-transaction
EdsipeRarjenAU, and MyISAM ?
arjenAUEdsipeR: you can do a single myisam table without lock, no worries, the lock is merely so that between the tables there is consistency otherwise a process could change another table while you dump antother
it's just a matter of inter-table consistency
which may or may not be relevant. you can switch it off. see mysqldump --help
EdsipeRI know, I'm getting some troubles trying to load a big SQL file, I think that the problem it's on the LOCK tables
I'm loading a file of 1.5G
Reiser2i need to know how i can use if in aquery
EdsipeRseems locked
chadmaynardSELECT IF(foo=bar, 'true', 'false') FROM table.
Reiser2i need help
hi chadmaynard
man, i have still problems to solve
chadmaynardhi reiser2. ok.
Reiser2chadmaynard: can you help me?
chadmaynardwith what?
Reiser2remember you help me to do a query to compare 2 columns in one table againts 2 columns in another one
chadmaynardno sorry i actually do not. But you can show me :)
Reiser2ok
SELECT (sap.no_doc=indices.numero_documento) AS coincidencias, indices.* FROM `indices` JOIN sap ON (indices.numero_documento = sap.no_doc) WHERE sap.fecha = indices.fecha_contabilidad;
that work very good
but in table Indices is a column (status), this column need to be updated if column comparison match
chadmaynardare you wanting the query to return anything or just update?

Page: 2 9 16 23 30 37 44 51 58 

IrcArchive

NY Lost Funds