join

Why different SQL results?

Why would the following queries return different result sets? select count(ml.link_type),mc.conv_string from MSP_CONVERSIONS mc,MSP_LINKS ml where ml.PROJ_ID = 4 and mc.STRING_TYPE_ID = 3 and mc.CONV_VALUE *= ml.link_type group by mc.conv_string select count(ml.link_type),mc.conv_string from MSP_CONVERSIONS mc left outer join MSP_LINKS...

asp.net :to call join method on more than one thread objects?

i have a listoddata and a list of thread in main thread .i am passing each element data of list to corresponding thread.want to main thread to wait untill all of thread are executed. for (int i = 0; i < listOfThread.Count; i++) { listOfThread[i].Join(); } // code after all of thread completes its...

SQL query to join several columns

I'm trying to join some data together from 2 tables, but on several columns. here's an example: Source table ID | Desc| AAAA| BBBB| Table2 table ID | Text| ID1 | ID2 | ID3 | where ID1, ID2 and ID3 in Table2 are ID's from the Source table I'd like to do a query which yields the results: Table2.Text, Source.Desc(ID...

T-SQL Subquery Max(Date) and Joins

I'm trying to join multiple tables, but one of the tables has multiple records for a partid with different dates. I want to get the record with the most recent date. Here are some example tables: Table: MyParts Partid Partnumber Description 1 ABC-123 Pipe 2 ABC-124 Handle 3 ABC-125 Light Table:...

SQL SELECT WHERE Trouble any ideas helpful

I have two tables parent and child (related as such on PK/FK GUID) Child has a Timestamp (the record creation date/time). What I want to do is get only the most recent child record AND the parent record, FOR EACH parent record. SELECT dbo_Parents.ParentName, dbo_ChildEntry.CountPropertys, dbo_ChildEntry.DateTimeStamp FR...

SQL left join vs multiple tables on FROM line?

Duplicate of: What’s the difference between just using multiple froms and joins? Most SQL dialects accept both the following queries: SELECT a.foo, b.foo FROM a, b WHERE a.x = b.x SELECT a.foo, b.foo FROM a LEFT JOIN b ON a.x = b.x Now obviously when you need an outer join, the second syntax is required. But when doing an inner joi...

Linq Joining IEnumerable(Of Struct) to IEnumerable(of object)

Hi, With class RoleRecord (Guid RoleId, string RoleName,...) I am trying to get a new list of Name where the RoleId matches a list of Guid IEnumerable<RoleRecord> roles; IEnumerable<Guid> roleIds; I was thinking about avoiding the nested for loops, and along the lines of : var query = from rowA in roles ...

How to implement outer join expression tree?

I need to implement the query using expressions syntax (because I don't know types in compile time). For example query like this one: from customer in Customers join purchase in Purchases on customer.ID equals purchase.CustomerID into outerJoin from range in outerJoin.DefaultIfEmpty() where customer.Name == "SomeName" && range.Desc...

SQL: grouping 2 tables as 1 with join, union, and then?

Here i am again :) I have 5 tables: customers id - name p_orders id - id_customer - code - date p_items id - id_order - description - price and h_orders and h_items, that are exactly the copy of p_orders and p_items. When the p_ tables reach a big amount of rows, i move the oldest to the h_ tables.. they due as history. So, my pro...

joining two 3D mesh objects

Hi All, Due to huge data amount, I want to form, separately, in two or more parts a 3D mesh object. And then, to be able to form the real 3D object, I shall join them in one part. Could you explain me by an example code how it can be done. Thanks in advance. Öner YILMAZ ...

Get total amount of rows from different table with matching ID

For my first table i have questions like this: qid | question | date 1 blah 22-05-2009 and then i have the table comments cid | qid 1 1 2 1 3 1 so then in my questions table i could have an added column which had total_comments which would be three Ive tryed using this code SELECT questions.qid, questi...

Python: Joining Multiple Lists to one single Sentence

Howdy, I've got multiple lists. For example: [u'This/ABC'] [u'is/ABC'] [u'not/ABC'] [u'even/ABC'] [u'close/ABC'] [u'to/ABC'] [u'funny/ABC'] [u'./ABC'] [u'O/ABC'] [u'noez/ABC'] [u'!/ABC'] I need to join this List to This/ABC is/ABC not/ABC even/ABC close/ABC to/ABC funny/ABC ./ABC O/ABC noez/ABC !/ABC How do I do that please? Yes,...

On Google App Engine, how would I look up the latest order for a customer in GQL?

If I have two tables, Customers and Orders, and I want to look up the latest order for a customer, how would I do this on Google App Engine using GQL? Normally, I would join these two tables through the foreign key, customer_id, which exists in the orders table. select orders.* from customers, orders where customers.customer_id = ord...

Advanced (?) SQL Joins?

I am a bit lost as to how to explain this, so I will try to give an example of some tables (+ data) and then the result that I am after (all my table columns are NOT NULL): Table: Customers Id int primary key Name varchar(250) Table: Stats (Date, CustomerId is the primary key) Date (date) CustomerId (int) - foreign key to Customers t...

SQL Server 2008 T-SQL Join problem ver 2

I have some table with data Category CategoryID CategoryName 1 Home 2 Contact 3 About Position PositionID PositionName 1 Main menu 2 Left menu 3 Right menu ...(new record can be added later) CategoryPosition CPID CID PID COrder 1 ...

How do I sort into a dynamically generated specific order in mySQL?

I've been beating my brains in over this and I'm making no progress. I'm not very good with SQL so I'm hoping the answer is something simple that I just don't know. I have 2 tables: One called "images" that contains the data I want, organized with a primary key "imageID". The other is called "productPhotos", and it contains two fields (...

Rails combined ('AND') searches on associated join tables

I cant get rails to return combined ('AND') searches on associated join tables of an Object. E.g. I have Books that are in Categories. Lets say: Book 1: is in category 5 and 8 But I cant get 'AND' to filter results using the join table? E.g ::-> Class Books has_and_belongs_to_many :categories, :join_table => "book_categories" Book.fi...

mysql nested SELECT in UPDATE of same table

Hi, Essentially I need to do something like this.... this is just an example... but the syntax of the first query doesn't work in MySQL update people set prize = '' where prize = 'Gold' and class = (select class from people where id = person_id); update people set prize = 'Gold' where id = <id>; Only one person can have the Gold pri...

How to Speed Up Simple Join

I am no good at SQL. I am looking for a way to speed up a simple join like this: SELECT E.expressionID, A.attributeName, A.attributeValue FROM attributes A JOIN expressions E ON E.attributeId = A.attributeId I am doing this dozens of thousands times and it's taking more and more as the table gets bigger. I ...

Subtracting one row of data from another in SQL

I've been stumped with some SQL where I've got several rows of data, and I want to subtract a row from the previous row and have it repeat all the way down. So here is the table: CREATE TABLE foo ( id, length ) INSERT INTO foo (id,length) VALUES(1,1090) INSERT INTO foo (id,length) VALUES(2,888) INSERT INTO foo (id,length) VALUES(3...