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
0
votes
2 answers

Simple SQL Select from 2 Tables (What is a Join?)

I'm new to SQL. I have a simple problem with getting the results from two different tables. I have two tables in a database. The first table has a column with an id reference, which corresponds to rows in the second table. What SELECT do I need to…
skibulk
  • 3,088
  • 1
  • 34
  • 42
0
votes
3 answers

Use LINQ to Join on Multiple Fields

How would I do this in LINQ? SQL Where tblAccounts.AccountCode = tblAccountAssociations.ChildCode And tblAccountAssociations.AssociationType = "DS" Here is my attempt. The problem seems to be with "assoc.AssociationType == "DS". Is it part of…
dorkboy
  • 447
  • 1
  • 7
  • 10
0
votes
3 answers

Verify existence of two columns in different tables in a single SQL transaction

I'm trying to verify if data exists in two different tables in a single transaction. The reason for the single transaction is the database gets hit about 1-3 million times a day so adding anymore than 1 extra transaction would increase that number…
bfritz
  • 2,416
  • 2
  • 20
  • 29
0
votes
3 answers

Query syntax error selecting from 3 tables

Given info about an object: id, user_id, group_id Given info about an user: id_user, id_loc I need to get i one query: The name of the user (in table users) The name of the location of the user (in table locs) The name of the group of the object…
Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378
0
votes
2 answers

Update table_A value based on table_B in Derby

I've got two tables: table A PK TBL_A_ID ITEM 0001 12345678 apple 0002 23456789 banana table B PK TBL_A_ID DESTINATION 0001 12345678 Boston 0002 23456789 London 0003 23456789 Rome 0004 12345678 Beijing I want to change table B…
0
votes
2 answers

MySQL sum of table sums with different where clauses

Trying to sum multiple sums from different tables with different where conditions for each table. Here's my 3 sums: SELECT SUM(1column2) FROM table1 WHERE 1column1 = '0'; SELECT SUM(1column4) FROM table1 WHERE 1column3 = '0'; SELECT SUM(2column2)…
user1382306
0
votes
2 answers

How to join three tables and add a "AND" operator?

Being a Rookie i am a bit lost as to how to nail this. I am trying to join three tables. This is the table structure: Accounts Table: 1) id 2) User_id (Id given to user upon sign up) 3) Full_name 4) Username 5) Email 6) Password Contacts…
ariel
  • 2,962
  • 7
  • 27
  • 31
0
votes
1 answer

Retrieve data from multiple tables in hibernate

I have 2 tables namely subscriber and contact. Tables look something like this: subscriber -> id, contact_id //contact_id is a foreign key contact -> id, firstName, lastName, email, contactType My Contact.hbm.xml file looks like…
Ahmed
  • 2,966
  • 7
  • 42
  • 69
0
votes
1 answer

Linq to Entities Inner Join to datagrid

I have two tables Artist table(PK: ArtistID), Movie Table(PK:MovieID) and a junction table ArtistMovie. How can I display some columns from both tables Artist and Movie in a datagrid using Linq2Entities: RentalEntities db = new…
ArchieTiger
  • 2,083
  • 8
  • 30
  • 45
-1
votes
1 answer

Use one jquery code for all tabs

I need help. I have 6 tabs on website. But when i`m clicking to one of the tab, all other tabs changes too. How i can to have unigue id for every tab ? Please help. This my codes: jQuery(document).ready(function () { // When user…
Ronin
  • 5
  • 2
  • 7
-1
votes
1 answer

MySQL - getting information from four tables in one query

This is the data structure: stores { id, name, city_id, owner_id } cities { id, name } store_managers { user_id, store_id } products { id, name, store_id } users { id, name…
yossi
  • 3,090
  • 7
  • 45
  • 65
-1
votes
0 answers

SQL left joins with nested full joins - poor performance and indexing

SQL beginner here. I am a r/o user of a very large oracle 12 db with many tables that have to be combined to build the desired output. (using custom sql in tableau to build report) basic structure is; Select cus_fields cus_loc_fields …
GwaiTsi
  • 1
  • 1
-1
votes
1 answer

How to Create Search Bar in ASP.Net Core, if we have our list view using StudentCourseViewModel

I have Student Table from database contains Student Roll No, Name, Mother Name, Class, Age, Fee Paid, CourseID(fk), IsActive in Course Table from database contains courseid(pk) and Course Name, IsActive Add New Student ... Course Comes from Dropdown…
-1
votes
1 answer

Combining the separate queries from multiple tables

Table1 ID | First | Last | Branch 111 Amy A 10 222 Yuki B 11 333 Smith C 10 444 David D 12 555 Mike E 13 Table2 Branch …
-1
votes
1 answer

Listing common data in multiple tables belonging to a category table with MySQL

i have 3 tables. this-> category, blog, course category table | category_id | category_name | | 1 | php | | 2 | python | | 3 | javascript | blog table | blog_id | blog_title | blog_category_id | | …
gencyazilimci
  • 31
  • 1
  • 6