Questions tagged [multiple-tables]

This tag will generally be used by those unfamiliar with SQL, asking basic questions about joins. In SQL, data is stored in tables. Frequently, queries need data from multiple tables, and the way that they are connected may not be obvious.

823 questions
2
votes
1 answer

SELECT from 2 tables

My tables: table1 id|name_transfer|id_account_from|value_from|id_account_to|value_to ------------------------------------------------------------------ 1 |transfer1 |1 |1000 |2 …
Alexander Shlenchack
  • 3,779
  • 6
  • 32
  • 46
2
votes
1 answer

R - How to subset certain rows out of multiple data frames

I am sure its an easy thing to do, but I did not find anything in the search function. My question is: I have 3 different dataframes and want to select 1 special row out of each dataframe and put these rows together in a new dataframe. How do I do…
Essi
  • 761
  • 3
  • 12
  • 22
2
votes
1 answer

Delete records from multiple tables in Access 2007

Using the following data, I am attempting to delete matching records from both tables. Fruits ID Value 1 Apple 2 Pear 3 Banana 4 Grape Animals ID Value 1 Bear 2 Monkey 3 Apple 4 Pig There is no defined relationship between these…
Sesame
  • 3,370
  • 18
  • 50
  • 75
2
votes
3 answers

mySQL Left Join on multiple tables with conditions

I have a problem. I have 4 tables: Invoice_Payment, Invoice, Client, and Calendar Basically, I have the below query, which works well, except, months with no date_due don't return. I.E only months with a date_due will be returned. Note: the calendar…
Jarrod
  • 9,349
  • 5
  • 58
  • 73
2
votes
1 answer

How to call a procedure using NHibernate that returns result from multiple tables?

Normally we create 1:1 mapping per table-class. Ex(Tables): [users] user_id - PK name [transactions] user_id - FK item_id amount Example mapping: public class User { public string ID {get; set;} public string Name {get; set;} } public class…
eSPiYa
  • 882
  • 1
  • 12
  • 29
2
votes
2 answers

Combine two tables which different number of rows in SQL server

I have two tables that I want to join to create one final table. Query 1 select DisplayName, Category, NoOfLevels , count(Underoverestimate) as OverCount , Avg(CaseDuration - EstDuration) as ODA from DSU where yearid between '2016' and '2018' and…
CandleWax
  • 2,159
  • 2
  • 28
  • 46
2
votes
4 answers

SQL - Count number of transactions if at least one of the transactions is today

I have a database of transactions made by customers such that each transaction has a specific date. I need to count the number of transactions made by each customer in the last two months ONLY if there was a transaction made by the customer today.…
aslade
  • 23
  • 1
  • 1
  • 5
2
votes
1 answer

Data representation on three tables in MySQL

Let's assume I have three tables, such as: Table A id | id_b | id_c ----------------- 1 | 1 | 2 2 | 2 | 1 3 | 1 | 2 4 | 2 | 3 5 | 3 | 3 6 | 2 | 1 Table B id | name ----------------- 1 | 'One' 2 | 'Two' 3 |…
Tuszy
  • 23
  • 3
2
votes
1 answer

Group rows in Pandas DataFrame based on complex condition

I have a basic dataframe, structured like this: Col1 Ind1 Ind2 0 key1 12 key2 35 1 key3 56 key4 24 key5 65 ...and another one like this: ColA 0 key1 1 else 2 else 3 key3 What I need is…
2
votes
2 answers

LINQ multiple join hanging

I have a LINQ query where I need to join 3 tables but it seems to be hanging on evaluating the expression. Do you see any problems with this or any ideas why I would be hanging? VS2010 output window shows different threads exiting with 0. Here is…
Liz Ravenwood
  • 73
  • 1
  • 8
2
votes
1 answer

SQL IF Statement or Flag using 2 Tables

I have 2 tables (1 main table and 1 supplementary table) with ID #'s on each table. Some ID #'s appear on both tables and some don't. I need to flag/new field (named Both) which shows if the ID # appear on the supplementary table and the main…
ddot201
  • 23
  • 2
2
votes
4 answers

mysql multiple tables vs 1 table

Im making a simple score keeping system and each user can have stats for many different games But i don't know if each user should have his own score table or have one big table containing all the scores with a user_id column Multiple Tables: table…
Ilia Choly
  • 18,070
  • 14
  • 92
  • 160
2
votes
2 answers

TROUBLE IN MULTIPLE SUBSELECT QUERY

I need to find the name, function, officename and the salary of all employee with the same function as PETER or a salary greater or equal than the salary of SANDERS. order by function and salary. There are two tables: office and employee table…
Regazzi
  • 95
  • 1
  • 2
  • 9
2
votes
1 answer

SQL 4 tables inner join pick up sum Nulls also?

I have 4 tables.... Employees, Customers, Orders and Order_Info. I am trying to inner join the 4 tables to sum up the order amounts and calculate the employees commission based on 7%. I am very close to solving this but I have one slight problem:…
finiteloop
  • 483
  • 4
  • 14
2
votes
1 answer

Is it possible to bind multiple datasource(data table) with One Datagridview?

Hello I`m making a windows application to check and use thread. I want to make like this. Winfrom design is like this In Datagridview I want to bind each rows with each datasource(or table) for example, as you can see, Process 1 is bind with…
Ryden Choi
  • 307
  • 4
  • 19