join

In a batch file, Combining two strings to create a combined path string

I need to take two strings and combine them into a single path string inside a batch file similar to the Path.Combine method in .Net. For example, whether the strings are "C:\trunk" and "ProjectName\Project.txt" or "C:\trunk\" and "ProjectName\Project.txt", the combined path will be "C:\trunk\ProjectName\Project.txt". I have tried using...

A join query for three tables!! for the given condtion below

I have three tables Orders table and customers table and orderstatus table, both order and customer table have customerid as common field,and order and orderstatus have order_status_id as common field customer table have firstname, lastname, phone and email address fields. Now if I have to search/select the orders according to custome...

How can I do this in SQL? I need to find possible permutations of a small table of data

Hi All, I have this small table of data. Dir LinkL LinkH East 19 27 East 27 29 East 29 31 West 46 49 West 49 51 West 51 61 These represent possible trips. How can I query this? For instance if you started at station 19, you could go from 19->27, 19->29, and 19->31. Three possible "trips" But starting from 2...

Join single row from a table in MySQL

I have two tables players and scores. I want to generate a report that looks something like this: player first score points foo 2010-05-20 19 bar 2010-04-15 29 baz 2010-02-04 13 Right now, my query looks something like this: select p.name player, m...

Upper limit to number of columns I can JOIN two tables on in MySQL?

Is there a limit to the number of columns I can JOIN two tables on in MySQL? ...

Django 'timeline'

hi there, i want to make a 'timeline' containing all mini blog posts from a user, and all the user he is following. I want all these posts to be ordered by date..But how can i 'join' the posts, because the 'following' relation is in another table, so i have to make some kind of a join between the two tables, for taking the data. For no...

Updating SQL table with calculations regarding previous rows

Hello, I'm trying to fix some errors on a big database of stock exchange data. One column (quantity) has the traded volume on each tick, and other column stores the cumulative volume (i.e., the sum of the previous ticks of the day). This second column is wrong in some cases (not a lot, so we can safely assume that no to adjacent ticks a...

How to display two columns in a join query that map to same column in second table

I have a table T1 with the following columns T1 ---------- ID | Name ---------- 1 Sender1 2 Receiver1 3 Receiver2 4 Sender2 Table T2 T1 --------------------- SenderID | ReceiverID --------------------- 1 2 1 3 4 2 I want to join the two tables in such a way that i want to get the sender and th...

How do I avoid complex joins in star schema?

My fact table holds a user score in a course he took. Some of the details of the course, which I have to show on the report, comes from more then one table (in the actual OLTP db). Do I create a none normalized version of that course entry in a dimension table? Or do I just join the fact table directly to the course table join to the oth...

Inner join with count() on three tables

Simple and fast question, i have those tables: //table people | pe_id | pe_name | | 1 | Foo | | 2 | Bar | //orders table | ord_id | pe_id | ord_title | | 1 | 1 | First order | | 2 | 2 | Order two | | 3 | 2 | Third order | //items table | item_id | ord_id | pe_id | title | | 1 | 1 | 1 | ...

MYSQL get other table data in a join

Hello, I am currently running this SQL SELECT jm_recipe.name, jm_recipe.slug FROM jm_recipe LEFT JOIN jm_category_recipe ON jm_category_recipe.recipe_id = jm_recipe.id WHERE jm_category_recipe.category_id = $cat" This returns the desired results except that I also need to return the name of the category that the recipe I am looking ...

ANDing in join condition???

Is it possible to use AND in a join condition? For example: SELECT * FROM items LEFT JOIN products as prod ON prod.prod_id = items.prod_id LEFT JOIN partial as p ON p.prod_model = prod.prod_model AND p.order_id=$order_id WHERE order_id = $order_id ORDER BY prod.prod_weight ASC I am guessin...

Which is faster: JOIN with GROUP BY or a Subquery?

Let's say we have two tables: 'Car' and 'Part', with a joining table in 'Car_Part'. Say I want to see all cars that have a part 123 in them. I could do this: SELECT Car.Col1, Car.Col2, Car.Col3 FROM Car INNER JOIN Car_Part ON Car_Part.Car_Id = Car.Car_Id WHERE Car_Part.Part_Id = @part_to_look_for GROUP BY Car.Col1, Car.Col2, Car.Col3 ...

SQL Inner join 2 tables with multiple column conditions and update

I am using this script, trying to join 2 tables with 3 conditions and update T1: Update T1 set T1.Inci = T2.Inci ON T1.Brands = T2.Brands AND T1.Category= T2.Category AND T1.Date = T2.Date but i encounter: Incorrect syntax near the keyword 'ON'. can't figure it out why ...

LINQ to XML, joining 2 XML files

i have got 2 XML files to join and having a lot of trouble joining them. Im trying to use LINQ to XML to do it, but i havent quite figured out how i can make them join, or if its possible. here is what they look like: <?xml version="1.0" encoding="utf-8"?> <routes> <route> <id>9</id> <street>3</street> <street>12</street...

Inner joins using LLBLGen?

How could I do a simple join using LLBLGen? table1 - clientTable (address, phone, etc) table2 - employeeTable (name, etc) table3 - clientEmployeeTable (clientid, employeeid) I'm filling out a datagrid using the employeeId with fields for the client information (address, phone, etc) and I'm not sure how I could retrieve this using LLBL...

Complex SQL Join help!

(For a quick recap please see sections titled , DATA. Can only get results in FIGURE A, and FIGURE B, what I want is DESIRED RESULTS, tried everything posted in the answers section.) All, I have been working hard to start smartly using joins in my application. Boy it took me a while but I think I am getting the hang of this, but I can't...

nHibernate Join syntax error

I am doing my first nHibernate Join. In my function below, I want to return a list of records for the specified query. Normally my List type is the class representing the database table. In this case, since I am doing a join, I created a custom class that only contains the fields for the columns I am retrieving from the database. How...

SQL join with Kohana ORM

I'm using Kohana 3.0.6 with ORM. I have a model named "truck" and in his table there's a column with the id of his maker ("maker"). Then I have the "maker" model with the id and the name in his table. I'm trying to do a simple LEFT-JOIN when I display the listing of the trucks so I can get directly the names of their maker. Here is my...

Multiple Queries = joined to create a single child-parent query result

hi, I'm not sure if this is an sql question or a combined sql/php question, so if i'm in the wrong question area, I apologize in advance. I'm use to mssql and not sure how to exactly do this within mysql however... i have a number of tables, all with left joins to create individual sql queries query 1: SELECT a.itemID , b.t...