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
3 answers

How to select data from columns in only one table when checking two tables limited by where clause in MySQL

There are two tables. I need to select the columns from ONLY the table where the color Red is in the Color or ColorName column. Columns ------- moms: id,Name, Number, Color dads: id,FullName, Phone, ColorName Data ---- moms: 1, Jill, 832,…
Theodis Butler
  • 136
  • 2
  • 9
2
votes
2 answers

MySQL JOIN 3 tables using multiple columns/keys

Complete newbie to mySQL. So any help will be appreciated. I have 3 tables -- carts, users, actions. carts: +------------+-------------+-------+ | cartId | session_id | userId|…
eager_learner313
  • 97
  • 1
  • 3
  • 11
2
votes
5 answers

Using SQL, what is the correct way to total columns from multiple tables into common groups?

I am coding a dashboard, and I need to pull some data out of Microsoft SQL Server. For a simple example, I have three tables, one master Category table, and two tables containing values linked to the Category table via a primary/foreign key…
Mark B
  • 23
  • 2
2
votes
5 answers

iOS program to use multiple UITableView in a single UIViewController

I am trying to implement 3 tables in a single segue in a storyboard. When one table is selected it will unhidden a view with another table and likewise one more. The following code i have used for one table the cell format of each table is different…
Spidy
  • 1,137
  • 3
  • 28
  • 48
2
votes
2 answers

sql select query among 3 tables

I have three tables: ITEMDISPLAYCOuNTS *this table stores who displayed which posts and howmanytimes postid, count, whodisplayedid POSTS *this table stores who posted what? postid, whopostedid ASPNET_USERS userid, username What I want at the end is…
renakre
  • 8,001
  • 5
  • 46
  • 99
2
votes
2 answers

Large Table vs Multiple Tables - Normalized Data

I am currently working on a project that collects a customers demographics weekly and stores the delta (from previous weeks) as a new record. This process will encompass 160 variables and a couple hundred million people (my management and a…
Dustin
  • 23
  • 3
2
votes
3 answers

MySQL Query with multiple conditions and multiple tables

I have three tables products, properties and product_properties. The subset of table structures and values are given below: products --------------------------------------------- | id | name | description | price …
Lalu
  • 732
  • 3
  • 8
  • 20
2
votes
1 answer

cakephp database table defining three dependent relationships

I have three tables (blocks, roles, users) where the following is true in the schema: blocks have many users users have many blocks users have many roles, but the roles are specific to the block (and the user) blocks have many roles, but the roles…
pinned5th
  • 23
  • 4
2
votes
2 answers

Joining many tables together using key from first table for all joins?

I would like to do something like this but can't get it to work: SELECT A.*,B.*,C.* FROM tableA A LEFT JOIN B ON A.ID = B.ID C ON A.ID = C.ID I.e. I need to use a field from the first table for all joins as tableB and tableC don't has any fields to…
Lars Ljungberg
  • 313
  • 1
  • 6
  • 19
2
votes
2 answers

iOS. Add the same second action for UITableView didSelectRowAtIndexPath event?

I have several UITableViews with ready delegate and dataSource methods. How to add the same second action/handler for these tables using subclassing but without of editing their didSelectRowAtIndexPath methods manually? If I use UIButtons instead of…
2
votes
0 answers

PHP Pagination Multiple tables? 9lessons.info theme

I have 6 table. how to join paginagion? Please help? TNX I had found an example of paging entries using PHP and MySQL, which I downloaded from here. I found out that it was designed for a single table only. Now my problem is about how to page a…
Ranger
  • 63
  • 4
2
votes
1 answer

Inserting rows to other tables while importing in SSIS

I have a transactions table in a flat file like ItemID ,ItemName ,CustomerID ,CustomerName ,Qty ,Price ,TotalValue and target transaction table will have ItemID,CustomerID,Qty,Price,TotalValue Now I have to import it into the transactions table…
Sudhakar B
  • 1,465
  • 9
  • 16
2
votes
2 answers

SQL query of Sum and Count from multiple tables

I have the following two tables: 1. BList BookingID AdultNo ChildNo BookingDate 2. BHandle BookingID TicketingStatus FinalSellingPrice FinalNett Staff What I want to do is get the distinct Staff with Sum of (SellingPrice) , Sum of (NettPrice),…
ymcCole
  • 103
  • 1
  • 4
  • 9
2
votes
2 answers

getting latest timestamp from 2 joined tables for each row output in select statement

I have 3 tables as shown below. I want to get a list of member names, ids, together with the latest activity time for each of them, given a particular member name search term. This 'latest activity time' is the latest time from comparing both the…
Yoga
  • 1,186
  • 1
  • 13
  • 24
2
votes
1 answer

How can I adjust this 3 Table MySQL join query to eliminate rows that contain a null value column?

I'm not quite sure how to best word this question. I don't necessarily need a way to eliminate rows that contain a column possessing a null value -- I just need to figure out how to adjust my query so it's only generating the single row result for…
John
  • 101
  • 4