join

Sybase 15 performance issue

I am working with Sybase 15 in my application and there is performance issue related with nested joins. I have stored procedure which selects 2 columns from 2 tables and compares equalities of over 10 columns between this 2 tables. But when I run this stor. proc., the result takes 40 minutes. I added "set merge-join off" statement to top...

Efficient MySQL query to find entries in A where not matched in B

I have a couple of tables (products and suppliers) and want to find out which items are no longer listed in the suppliers table. Table uc_products has the products. Table uc_supplier_csv has supplier stocks. uc_products.model joins against uc_suppliers.sku. I am seeing very long queries when trying to identify the stock in the products...

How to query three related tables efficiently (JPA-QL)

Let's say I have entities A, B, C and each A has many B and C entities. I want to query a load of A entities based on some criterea, and I know I will be accessing all B and C entities for each A I return. Something like select a from A as a join fetch a.b join fetch a.c would seem to make sense at first, but this creates a huge product...

Why does join fetch not work with a one-to-many relationship?

I have three entity classes A, B, C. A has a many-to-many relationship with B, and a one-to-many relationship with C. select a from A join fetch a.b Produces one query as expected select a from A join fetch a.c Produces n+1 queries. What am I missing? ...

How to join results from two tables in Oracle 10

Let say that I have 2 tables with the same structure : STOCK and NEW_STOCK. These tables have a primary key composed of (ID_DATE, ID_SELLER, ID_INVOICE, ID_DOC). Now, I need to get for every (ID_DATE, ID_SELLER, ID_INVOICE, ID_DOC), the value of the amount (field AMOUNT) regarding this requirement: If a record is present in NEW_STOCK, ...

Is LINQ Join operator using Nested Loop, Merge, or HashSet Joins?

Hello Does anyone know what Join algorith does LINQ performs with its Join operator. Is it NestedLoop, Merge, or HashSet? Is there any way to specify a different one, if supported? Regards Albert ...

Add timeout argument to python's Queue.join()

I want to be able to join() the Queue class but timeouting after some time if the call hasn't returned yet. What is the best way to do it? Is it possible to do it by subclassing queue\using metaclass? ...

Left join in SubSonic Problem

I'd like to perform an left join in this query.The query like: select ... from tableA left join tableB on tableA.Cola=tableB.Colb and tableB.Colc='some value' I want to know how to perform the "and" condition,i try to coding like: new SubSonic.Select().From("tableA").LeftOuterJoin ("tableB","Colb","tableA","Cola").AndExpression("Colc...

Trying to "add" one column to a table via SQL JOIN

I want to join two tables together and have ONLY the data in Table 1 (but every record) and add the data from a column in the other table if applicable (there won't be a match for EVERY record) I tried using a LEFT JOIN matching four columns but I get doubles of some records. If there are 1050 records in table 1 I want 1050 records ret...

HQL joining a class and a joined-subclass

Hi, I have a class Top and a Bottom, Bottom is a joined-subclass to Top like: Well, I'd like to join them in hql like: select t.id Top t left outer join Bottom b on t.id = b.id. But I don't know how. Any idea ¿? thanks! ...

c# pgm to implement a stack using multithreading with using join and lock

hi, i am new to c# and multithreading. please help me how to write a c# program to implement a stack of integers using join and lock statements... ...

WHERE conditions in subquery while using ANSI joins.

Why doesn't it work? SELECT a.* FROM dual a JOIN (SELECT * FROM dual WHERE 1=1) b ON (1=1); I get "ORA-00900: invalid SQL statement". Is there a way to use WHERE clause inside the subquery? Edit: Version 9.2 SELECT * FROM v$version Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production The following executes j...

Do UPDATE in SQL using a JOIN

Hi I am using SQL Server 2008, and trying to run the following query in management studio: UPDATE Table1 as T1 INNER JOIN Table2 as T2 ON T1.ID=T2.ID SET T1.SomeValue = T2.SomeValue GO Doesn't work though. Is this sort of thing supported? Karl [EDIT] Let me just be more clear, I wan't to do somethin...

Not unique table/alias: 'usertns_group'1066 Please tell me if you spot the error

The code below looks painstakingly long... but pls if u can spot the error, tell me.. I dont see any duplicates of the alias 'usertns_group' so i wonder why im getting that error.. post LEFT JOIN category2 as postcategory2 ON( post.category2_id = postcategory2.category2_id ) LEFT JOIN category1 as category2category1 ON( postcategory2...

SQL Joining tables based on a list of names

Hi, I'm looking for a way to join a series of SQL tables based on a list of table names. The list of table names can change as the system grows but I need to make sure the join operates on all the tables as they grow. Each table in the list will have a common column called ActivityID which is a foreign key back to the Activity table wh...

How to return zero using Count() with multiple tables

i have three tables (SQL Server) Month - month_id, month name, .... Award - award_id, award name, .... Nomination - fk_award_id, fk_month_id, name, address,... I need to count the number of different types of awards awarded per month while returning 0 in cases where nobody is awarded for ex. the results should look like A...

Retrive data from two tables in asp.net mvc using ADO.Net Entity Framework

Please read my question carefully and reply me. I have two tables as table1 and table2. In table1 i have columns as AddressID(Primary Key),Address1,Address2,City In table2 i have columns as ContactID(Primary Key),AddressID(Foriegn Key),Last Name,First Name. By using join operation i can retrive data from both the tables. I created a...

SQL: how to select single record for multiple id's on the basis of max datetime?

I have the following SQL table, Id WindSpeed DateTime -------------------------------------- 1 1.1 2009-09-14 16:11:38.383 1 1.9 2009-09-15 16:11:38.383 1 2.0 2009-09-16 16:11:38.383 1 1.8 2009-09-17 16:11:38.383 1 1.7 2009-09-19 16:11:38.382 ...

ANSI vs. non-ANSI SQL JOIN syntax

I have my business-logic in ~7000 lines of T-SQL stored procedures, and most of them has next JOIN syntax: SELECT A.A, B.B, C.C FROM aaa AS A, bbb AS B, ccc AS C WHERE A.B = B.ID AND B.C = C.ID AND C.ID = @param Will I get performance growth if I will replace such query with this: SELECT A.A, B.B, C.C FROM aaa AS A JOIN bbb AS B ...

MySQL - Join Based on Date

Is it possible to join two tables based on the same date, not factoring in time? Something like: ...FROM appointments LEFT JOIN sales ON appointments.date = sales.date... The only problem is it is a datetime field, so I want to make sure it is only looking at the date and ignoring time ...