Re: Many-Many relation, matching all

2006-11-28 Thread James Northcott / Chief Systems
Peter Brawley wrote: >I want to find all A's such that >they have exactly B's 1 and 2 >SELECT A.ID, group_concat(BID ORDER BY BID) as Bs >FROM A INNER JOIN AhasB ON A.ID=AID >GROUP BY A.ID >HAVING Bs='1,2' Why the join? Doesn't your ahasb bridge table already incorporate the join logic? If your

Many-Many relation, matching all

2006-11-27 Thread James Northcott / Chief Systems
Hello, I'm having a conceptual issue with many-to-many relations. I have the following structure: Table A ID (int primary key) ... descriptive columns ... Table B ID (int primary key) ... descriptive columns ... Table AhasB AID (references A.ID) BID (references B.ID) So,

segmentation fault with mysql_num_rows - C API in Apache module

2002-12-09 Thread James Northcott
I am writing an Apache module that has to perform some queries against a MySQL database. For the most part, it is working properly. However, when I get an empty result set for my query (that is, the select returns no rows) I get a segmentation fault when trying to call mysql_num_rows. Here is th

RE: Newbie: Intersecting entities

2002-11-07 Thread James Northcott
> systems > > sys_nameID > > Abrams 202 > Patriot 544 > Stinger 229 > > ... and ... > > new_req > > proj_name ID > > Test Bed Alpha 3

RE: Complicated (to me) query

2002-11-07 Thread James Northcott
> What I want to do is display to the user a list of files that > require a > security level that is less than or equal to the user's > security level, with > formatted last name and first name and date if the file is > checked out. > > Checked out by is a foreign key refering to username in th

RE: Interesting Challenge

2002-11-04 Thread James Northcott
> mysql> SELECT cell, sector, If you only want one row, then selecting cell doesn't make any sense. Cell is different in each row you've selected. If you only want one row, don't select cell. > -> sum(att) as att, > -> sum(lc) as lc, > -> sum(csh) as csh, > -> ROUND((SUM( lc + cs

RE: MySQL and binary data

2002-11-04 Thread James Northcott
> Whenever I insert data that is > around 1 Megabyte in size, I get an error saying > "MySQL server has gone away". It doesn't happen with > smaller data, and even if I change the column type to > LONGBLOB I still have this problem. You've hit the default maximum packet size of 1 MB. This is a pr

RE: i almost hate queires, please help!!!

2002-10-30 Thread James Northcott
> Here's what I did. Based on the same query (the one you > provided) as below > I executed the following: > > select mgrname, pjname from managers, projects, pocs > WHERE pjid = 'x' > AND pocs.pjid = projects.pjid > AND pocs.pmyid = 'x' > AND pocs.altid = 'x' > AND (pocs.pmyid = managers.pmyid

RE: Query - Top Ten

2002-10-29 Thread James Northcott
> Hello, > > I have a table with the following structure and values: > > CustomerIDScore > > 4 8 > 2 6 > 3 2 > 3 8 > 4 7 > 2 7 > > I would like to query

RE: Rows examined / sent

2002-10-29 Thread James Northcott
> # Query_time: 17 Lock_time: 6 Rows_sent: 207550 > Rows_examined: 207550 > SELECT ID FROM sys_users; If this is really the query that you want to do, there really isn't much you can optimize. You're asking for every ID in the table, so MySQL has to examine every row, and send every row. You