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

Error on sqlite database with 2 table creation in android, unfortunately,"dbtest2 has stopped"

package com.example.dbtest2; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DataBaseHelper extends SQLiteOpenHelper { public static String…
-2
votes
1 answer

How to obtain data from multiple tables with same design in SQL

I am relatively new to SQL. I have tables emp010115, emp020115, emp030115 .... upto emp310115 for each date of January 2015 [name of the table denotes the date for which it belongs]. The design of all the tables are the same. Let the data in the…
ajeesh_ed
  • 163
  • 1
  • 2
  • 8
-2
votes
1 answer

Retrieve data from multiple tables MySQL

I have 2 tables: "media" and "rating" I need to retrieve all data from both tables where "media" has a title, description and a image. "rating" only stores the media id and a vote (1 - 5). My problem is that when i try to retrieve data and the…
-2
votes
2 answers

Using a group by to group a select statement

Using a group by to group a select stament SELECT k.Ivalue, k.JOBDESCRIPTION , count( k.Ivalue) as TOTAL FROM (SELECT a."ID" as Ivalue, b."JOBDESCRIPTION", rq."CURRENTSTATUS" FROM tblG2o_Requests a INNER…
Prince
  • 43
  • 9
-2
votes
2 answers

How can I retrieve data from 3 tables in mysql - join assistance?

Table layout: Hi, I would like to retrieve a combination of information from the above tables, primarily a single row of results from the 'episode' table, but also some information from the 'tvshow' table and the 'season' table, that also only…
John Bergqvist
  • 852
  • 13
  • 38
-2
votes
2 answers

Multiple results from an SQL query

I am not 100% sure how to phrase this question. I searched through the archives as much as I could but could not find what I was looking for. I have three database…
Jono Hill
  • 3
  • 2
-3
votes
2 answers

How do I do this ridiculous SQL multiple join statement?

Ok, I'm scrapping the old since the code has changed a lot. Here's what I now have: SELECT article.articleId, article.articleName, article.articleStoryTypeId, artIndustry.industryName, author.userPrefix, author.userMiddleName, …
James
  • 3,765
  • 4
  • 48
  • 79
-3
votes
5 answers

SQL - How do I select rows from one table depending on data from two other tables?

I have an SQL question. It's a simple problem, but I'm not an SQL guy at all. Here is the situation, I have three tables: CUSTOMER( PK(customer_id) ) LOAN( PK(loan_id), customer_it, behavior_id ) BEHAVIOR( PK(behavior_id), …
Chihab
  • 403
  • 5
  • 11
-3
votes
1 answer

SELECT count from multiple tables between 2 dates with BIG DATA

I have multiple tables (same column structures) which I want to have the count rows between 2 date ranges. Right now it gives me all records from each table. Each table have around 700K records, which makes it also slow to search through. I'm not…
Marios
  • 41
  • 10
-3
votes
1 answer

SQL-SERVER Procedure How do i insert row one table then insert row into another table link to another table as foreign key

database diagram For sql-server How can I insert a SKU row into table SKU_DATA, then insert the SKU into INVENTORY table with all branches and Quantity on hand=2 and Quantityonhand=0. I need to insert a SKU item into SKUDATA and correspond row in…
-3
votes
1 answer

Find average amount paid to each doctor

Create Table Doctor( doctorID varchar(50) Primary key, doctorFName varchar(50), ); Create Table Appointment( appID varchar(50) Primary Key, doctorID varchar(50) Foreign Key References Doctor(doctorID), ); Create Table Payment( …
Niveth
  • 1
  • 2
-5
votes
1 answer

Find Duplicates greater than "x"

Write a query that finds all records with the same Last Name, First Name, and State in tables named "Table 1" and "Table 2" that have an age greater than 45. The "Table 1" table columns are "Last Name", "First Name", "State", and "Age" The "Table 2"…
1 2 3
54
55