join

What's the equivalent C# 'Thread.Join()' in Cocoa?

I'm making an iPhone app using threads. I was used C# for a while, there was a method Thread.Join() which blocks current thread for specific thread completes execution. What's the equivalent in Cocoa for it? Or Alternatives? ---edit--- PS. I'm using NSThread. ---edit--- I'm finding a method like 'waitForThreadExit' which blocks calle...

How do I JOIN these tables?

I have two tables: **WEEK** -id -week # **ITEM** -id -name -is_marked -week # My final desired result is to have a table that has a rowspan="3" table cell with week # in it, followed by the three results for each week from SELECT * FROM item WHERE week = week_number AND is_marked = 1 I don't know if I need to JOIN anything bec...

Linq Sum for Multiple Joins

Hi, Can someone help me out with the following Linq statement? I'm trying to get join 4 tables through Linq, group by the last table and sum a property of the first. var payments = ( from payment in db.Payments join payees in db.cmsMembers on payment.PayeeID equals payees.nodeId join paye...

How to use OR Condition in Paginate function in Cakephp ??

Hi! I am facing a problem while fetching values using paginate function in cakephp. In the "to" field of message I have CSV fields of userid. To search messages for a single user. I am using the code below... $this->set('message', $this->paginate('Message', array( 'or'=> array( "Message.to LIKE" => "".$this->Session->read('...

JPA : optimize EJB-QL query involving large many-to-many join table

Hi all. I'm using Hibernate Entity Manager 3.4.0.GA with Spring 2.5.6 and MySql 5.1. I have a use case where an entity called Artifact has a reflexive many-to-many relation with itself, and the join table is quite large (1 million lines). As a result, the HQL query performed by one of the methods in my DAO takes a long time. Any advice o...

Is it possible to create indices on join table using Hibernate annotations and hbm2ddl?

I have a two entities in many-to-many association. Hibernate creates a join table for this association if hbm2ddl is activated. However, since I do not have an entity for this table, I can not apply @Index annotation. Is there a way to tell hibernate hbm2ddl to generate indices and primary key on the join table? ...

Fluent NHibernate join single column from another table

Hi, I'm using Fluent NHibernate and have two tables; Customer [ID, Name, LanguageID] Languages [ID, Description] I have a Customer entity with the following properties; ID, Name, LanguageID, Language What I would like to do is to join to the Languages table to get the language description and put it in the language property of the c...

Using %rowtype with a join and duplicate columns

Given (ignore the lack of primary keys, foreign keys, etc - this isn't about table design and is just an example): Order: ---------- ID NUMBER; VENDOR NUMBER; PART NUMBER; Parts: ------------ ID NUMBER; VENDOR NUMBER; DESCRIPTION VARCHAR2(1000 CHAR); cursor c1 is select * from order o left join parts p on o.part = p.id; c_row c1%rowt...

Need help with a SQL join: Conditional Matching?

I'm joining 2 tables. ACCOUNTS account_number region product 1234 100 AB 2345 0 AB 3456 300 CD 4567 0 CD PRODUCTS product region price AB 100 $1.50 AB 0 $1.25 ...

nested dependent sql question

I'm trying to implement a front end for a reporting solution which is security dependent. The user has 12 levels of nested criteria to select from, the value of each affects all of the values below. So the criteria selection on the page (each is a dropdown) looks something like this: Criteria 1 Criteria 2 ... Criteria 12 There is a...

Limit the number of rows to join to, in mysql

So I want to join two tables together, but for each row in the first table, I only want to join it to the top 8 matching rows in the other table, ordered by one of the columns in that table. Any clever syntax I can use, or do I need to get messy with subqueries? ...

Non-standard joins in QlikView?

Lately we have been testing QlikView in the office. The first impression is good: it has an attractive interface and performs very fast. We want to use it as a database frontend for our customers. We are also trying to determine whether it can take over parts of our relational database structure. However, we are in doubt whether its data...

Hibernate Criteria and multiple join

is possible with Hibernate criteria do it? select A.something, B.something, C.something, D.something from A JOIN B on A.id = B.id_fk JOIN C ON B.id = C.id_fk JOIN D ON C.id = D.id_fk; ...

MYSQL: returning zero when no value is present, categorized monthly

I have the following two tables that record expenditure and provide expenditure category information: Table transactions: +-------+--------+--------+ | month | cat_id | amount | +-------+--------+--------+ | 1 | 2 | 3 | | 1 | 2 | 8 | | 2 | 1 | 7 | | 2 | 1 | 5 | +-------+--------+-...

MySQL inner join problem

I have 2 tables : users : contains id and name friends : contains id1 and id2 Let's suppose I have this data in the users table : id : 1 , name : FinalDestiny id : 2 , name : George And this data in the friends table: id1: 1 , id2: 2 So this means that 1 is friend with 2. I need with one single query to say that id1 is friend ...

employee database with varing salary over time.

Hello, I have the following tables: PROJECTS - project_id, name EMPLOYEES - employee_id, name SALARY - employee_id, date, per_hour HOURS - log_id, project_id, employee_id, date, num_hours I need to query how much a project is costing. Problem is that Salary can vary. For example, a person can get a raise. The SALARY table logs the...

Optimize SQL query

I'm trying to optimize this slow query (>2s) SELECT COUNT(*) FROM crmentity c, mdcalls_trans_activity_update mtu, mdcalls_trans mt WHERE (mtu.dept = 'GUN' OR mtu.dept = 'gun') AND mtu.trans_code = mt.trans_code AND mt.activityid = c.crmid AND MONTH(mtu.ts) = 2 AND YEAR(mtu.ts) = YEAR(NOW()) AND c.deleted =...

Search in multiple tables

Let's say I have tree tables: [ news ] id title text date [ posts ] id title text date [ gallery ] id title text date How can I perform a FULLTEXT search in these tree tables with one query? I just want to run the search on the title and text fields and get the id, title, date and the...

[MySQL] JOIN; only one record please!

OK, I have a complicated query from a poorly designed DB... In one query I need to get a count from one database, information from another with a link from another, here goes: Each blog has a type (news, report etc) and a section Id for a certain part of the site but it also can be linked to multiple computer games and sections) type (...

Limiting Results on Join Query

Say I have the following tables: |RefNumber| Charge| IssueDate| ------------------------------ | 00001| 40.0|2009-01-01| | 00002| 40.0|2009-06-21| |ID|RefNumber|Forename| Surname| --------------------------------- 1| 00001| Joe| Blogs| 2| 00001| David| Jones| 3| 00002| John| Smith| 4...