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

Update multiple tables in a single query in mysql

I have three query and I would like to have a single one. These is my query: UPDATE tab1 SET a='' WHERE id=3; UPDATE tab2 SET b='' WHERE id=9; UPDATE tab3 SET c='' WHERE id=5;
Francesco G.
  • 679
  • 3
  • 13
  • 32
2
votes
2 answers

ORACLE - Count from two tables with group by

I've two tables (table1 and table2) that share a column (day_code number). I want to obtain the count of records that each table have from a minimum day_code and group by the results by day_code. Table 1 (number of records by day_code) 20160703 -…
2
votes
0 answers

Hive - optimize multiple table joins

I need to join multiple tables in a single query and then overwrite another table. Focus/Driver table: FACT (huge, bucketed on ID) Join Table 1: T1 (big, but smaller than FACT, bucketed on ID and joined with FACT on FACT.ID) Join Table 2: T2 (big,…
user3031097
  • 177
  • 3
  • 15
2
votes
0 answers

Updating multiple tables when saving entity Spring MVC Angular

I have a problem with saving entity with references to database using Spring MVC and AngularJS. My entities: Entity @Table(name = "comment") public class Comment { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "id",…
user3096746
  • 61
  • 1
  • 12
2
votes
4 answers

Listing data from mysql tables

recipe_category cid | category 1 | desserts 2 | cakes 3 | biscuits recipe_name id | recipe_name | cid | iid 1 | black forest cake | 1,2 | 1,2,3,4 2 | angel cake | 2 | 1,2,4 3 | melting moments | 3 | 2,5 4 |…
circey
  • 2,032
  • 6
  • 35
  • 51
2
votes
0 answers

Join through multiple tables in nHibernate via QueryOver

I have these tables: components, devicehardwareprofiles, componenttemplates, cashrecyclercounters on MsSql database I need to fill this variables: int capacity, loaded by data from this query: select sum(ct.capacity * cc.denomination) as capacity,…
2
votes
3 answers

Get IDs from multiple columns in multiple tables as one set or array

I have multiple tables with each two rows of interest: connection_node_start_id and connection_node_end_id. My goal is to get a collection of all those IDs, either as a flat ARRAY or as a new TABLE consisting of one row. Example output ARRAY: result…
LarsVegas
  • 6,522
  • 10
  • 43
  • 67
2
votes
1 answer

mysql pagination with multiple tables

I have 2 two tables: organisations (id, name) organisationsmeta (id, orgId, metaKey, metaValue) Each organisation can have multiple associated meta rows. I'm using a Left Join right now since there can be organisations without any meta data. How do…
2
votes
3 answers

Auto increment over multiple identity columns in MS SQL 2005 or 2008

I want to have two different tables in MS SQL, for example users and groups, both with identity column. It is possible to create auto increment over two identity columns? I want to have third table with common informations to these two tables and I…
2
votes
1 answer

Joining multiple tables on one join statement?

Is it possible to do the following join? Select * From table1 Inner join table2 on table1.pk = table2.fk Inner join table3 on table2.pk = table3.fk and table1.pk = table3.fk Normally I have only use two tables in one join statement. The last…
Sheng Liu
  • 79
  • 1
  • 8
2
votes
2 answers

mySQL multiple inner joins

I have two tables I'm pulling information from. Lets say table1 has following columns (id, title, category, sub_category, sub_sub_category) Lets say table2 has following columns (category_id, category_name) I have a select statement that so far…
Aaron
  • 41
  • 1
  • 5
2
votes
2 answers

How to join master table to multiple details table with extra rows of details cell filled with NULL

I am not sure how appropriate is the question title. My problem is similar to the thread How to Join Multiple Detail Tables to Header Table . But this one too giving duplicate records. Here is my situation I have a master table and two details…
a4ashiq
  • 79
  • 2
  • 8
2
votes
0 answers

Doctrine 2: multiple tables - one entity

How can I map multiple tables with identical structure to entity? For example we have these tables : Object_001 (id, name, lat, long) Object_002 (id, name, lat, long) Object_003 (id, name, lat, long) .......... Object_41000 (id, name, lat,…
2
votes
1 answer

How to display multiple tables in one view using django-tables2?

Using djt2 v0.15/dj1.6/pyth2.6.6 djt2 doc example views file for multiple tables: def people_listing(request) : config = RequestConfig(request) table1 = PeopleTable(Person.objects.all(), prefix="1-") table2 =…
2
votes
1 answer

MySQL join multiple columns from multiple tables

I am trying to combine multiple columns from multiple tables, but some of my data seem to be recurring. How should my query be to avoid this? I have the following tables: LEGE_ROM +----------+------------+-----+ | ansattnr | dag | rom…
slimmey
  • 29
  • 7