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.
Questions tagged [multiple-tables]
823 questions
3
votes
2 answers
Multi-table recursive sql statement
I have been struggling to optimize a recursive call done purely in ruby. I have moved the data onto a postgresql database, and I would like to make use of the WITH RECURSIVE function that postgresql offers.
The examples that I could find all seems…

ekampp
- 1,904
- 18
- 31
3
votes
3 answers
SQL query with multiple unrelated tables
In my mySQL database there are four tables: breakfast, dinner, supper, supper.
Column names of these tables are the same. Everyone one of them has a column called 'accepted' which is equal to either 0 or 1.
I want to make the SQL query that gives me…

CPG
- 33
- 7
3
votes
1 answer
How to compare condition multile table in mysql query?
how can i compare multiple table while checking condition in MySQL?
Cheque Table1
--------------------------
date | Cheque_no
--------------------------
10/10/2015 | 09876543
--------------------------
17/10/2015 |…

Dinesh G
- 1,325
- 4
- 17
- 24
3
votes
1 answer
Get row values from foreign key MySQL
This may sound simple and dumb but how can I get the values of a foreign key from a table and displaying it?
I have a table named "subjects" which contains different school subjects and one column of it is a foreign key referencing from table named…

King Soul
- 33
- 1
- 4
3
votes
1 answer
How to create View in MySQL to combine rows from second table as CSV colmuns in first
I need to create VIEW in MySQL which can combine two tables in such way that for each row from first table there must be added columns from second table but as row data have to be formatted as multiple filds with multiple CSV for every single…

vzr
- 105
- 1
- 7
3
votes
0 answers
FOSOAuthServerBundle with multiple user providers
I have several Entities implementing UserInterface on a project (applications and their users) but seems FOSOAuthServerBundle can be instantiated with only user_provider, but I need to have opportunity to extract from token different Entities of a…

htochko
- 441
- 1
- 4
- 6
3
votes
2 answers
Transactions across multiple tables in Azure Table Storage
I'm creating a dashboard using Extjs 5 and azure table storage.
I've done single table transactions using the table batch operations (TableBatchOperation) but now I want to do transactions across multiple tables.
Is there anyway to achieve this?…

Dushan
- 49
- 1
- 4
3
votes
1 answer
Filter a Table based on another Table
One includes the TMC # for all the roadways of interest. The second includes travel times occurring on every single roadway in a particular state. I want to use the first table to filter so that only the records corresponding to those roadways of…

mgc77
- 113
- 1
- 9
3
votes
1 answer
Query on multiple tables using dbGetQuery of RMySQL package
With the help of dbConnect, multiple connections were established with SQL DBs (say, DB1 and DB2). How can I write a query that involves tables from DB1 and DB2? Does dbGetQuery allow querying one only one DB? Can sqldf package be leveraged after…

Anindita
- 31
- 3
3
votes
1 answer
Hive - grab from two tables without join
In MySQL, I can select from two tables without a join, like so:
SELECT t1.value, t2.value FROM t1, t2 WHERE (t1.value = t2.value);
Hive, on the other hand, will accept "FROM t1 join t2" but not "FROM t1, t2".)
Does anyone have any ideas about how…

maia
- 3,910
- 4
- 27
- 34
3
votes
1 answer
Joining multiple queries of SUM into one result
So.... we have three different tables that pertains to a contest in which the DB keeps track of how many points they've received for each contest. Contest 1, 2 and 3. Each time that user achieves something, a new row is created for that user with…

Brian Schermerhorn
- 1,361
- 1
- 15
- 22
3
votes
3 answers
SELECT multiple values to the same key in multiple tables
I have two tables in the following structure
table_1
uid | name | age
1 | John | 24
2 | Adam | 35
3 | Sara | 26
table_2
id | uid | meta_key | meta_value
1 | 2 | location | NY
2 | 2 | school | NYU
3 | 3 | Location | NY
4 | 3 |…

Motaz M. El Shazly
- 49
- 9
3
votes
3 answers
MYSQL QUERY LEFT JOIN SHOW ALL DATA FROM ONE TABLE
SELECT
A.CODE,
B.NOTE,
C.NUMBER
FROM (A
LEFT JOIN B
ON A.CODE = B.CODE
LEFT JOIN C
ON A.CODE = C.NUMBER
)
WHERE C.ID = B.ID
Need to show some results combined from 3 tables, but my results show all data from table B reported also if the data…

user2239318
- 2,578
- 7
- 28
- 50
3
votes
1 answer
Query multiple tables including rows with null foreign keys MySQL
It's my first time with mysql and I need some help. I couldn't find any solution to this probably because it's too easy or I'm too noob to look it up properly yet.
I want to make a query from multiple tables from my test database. Let's say tables…

Guillem
- 41
- 1
- 5
3
votes
1 answer
Mysql Join Multiple Table Excluding Some Records
I am not very good in MySQL so need some help. I have three tables author (author_id, name), book (book_id, name), publisher(id, author_id, book_id)
I want to fetch only those authors who have written/publish book just on rdbms.
I tried:
SELECT…

user1999074
- 35
- 4