Questions tagged [table-relationships]
220 questions
1
vote
2 answers
Rails 4: Displaying tables related with user_id
I am trying to create a resume builder. Inside the resume, I would like to display the first corresponding Job title to a specific User in the show.html.erb.
I first made sure that Jobs has the user_id foreign key..
Schema
create_table "jobs",…

shroy
- 918
- 2
- 10
- 24
1
vote
1 answer
Eloquent table relations
I am trying to pull a list of characters that belong to a certain user. When I make the request I get an SQL Error. Reading through the error it is trying to us fields that don't exist.
Error:
SQLSTATE[42000]: Syntax error or access violation:…

Dylan Buth
- 1,648
- 5
- 35
- 57
1
vote
0 answers
Rails relationship - SQLite3::SQLException: no such column
I receive error What happens??
Showing /Users/manu/Desktop/videocv/app/views/resumes/index.html.erb where line #16 raised:
SQLite3::SQLException: no such column: resumes.candidate_id: SELECT "resumes".* FROM "resumes" WHERE…

imacnu
- 11
- 1
1
vote
2 answers
Using Related Models in Phalcon with Namespaces
I've been working with Phalcon and slowly getting to grips with it. However, I've stumbled across an issues and it's got me stumped. I'm hoping that someone else can provide some assistance.
I have two tables in the DB that are related as a…

rabrowne
- 61
- 6
1
vote
0 answers
Filter Eloquent morphTo relation based on column in other table
I have an Eloquent model, that morphs to other Eloquent models, like this:
morphTo('message');
}
}
The reason being, the application has many…

Martin Bean
- 38,379
- 25
- 128
- 201
1
vote
1 answer
Azure Mobile Services with Android
I am very new to both Android development & Azure Mobile Services. I have a decent knowledge of Java so Android development is not proving to be too difficult. Although, I am struggling to gain a good knowledge of working with Azure Mobile Services.…

GermaineJason
- 589
- 6
- 15
1
vote
2 answers
Commenting "the rails way" - regarding table relationships and the rails way or tackling problems
I'm looking to implement a site wide comment/message feature into my apps entities. This will enable people to comment on the following modules
Newsletters
Reports
Tasks
and user to user (messaging)
My plan would be to make a foreign key called…

David Sigley
- 1,126
- 2
- 13
- 28
1
vote
1 answer
How to relate entities - users with multiple roles
I have 3 entities to represent Users, Roles and Conferences
So far I got this diagram:
So,
-A user can be associated with zero or more conferences.
-A conference may have one or more users.
and...
-The same user can have different roles depending…

David Rego
- 163
- 2
- 13
1
vote
4 answers
Generaly in database design what is better one table with two references or one table?
Let's say i have people who search for jobs, and i have a list of jobs.
So i have two tables:
people and jobs.
Now i have a list of skills of the person, and i have a list of skills for the job requirement.
What is better to have ONE skills table…

aviv
- 2,719
- 7
- 35
- 48
1
vote
2 answers
Two FK to one PK
I'm using SQL Server Express 2012 and trying to make two relatonships, two FKs from the same table to one PK in another table.
The relationship seems to work because it shows up in the database diagram but when I try to save the changes, I receive…

MikeAlike234
- 759
- 2
- 12
- 29
1
vote
3 answers
Mysql one to many relationship. Order by number of rows in second table
I have created a voting system in php and mysql. When a user votes on an id, a record is inserted in "votes" referencing the FK media_id. When I then display the entries I use this query to get the number of votes for each entry:
$sql = "SELECT…

Cobradelaplaya
- 63
- 4
1
vote
1 answer
What should my Model relationships be for this CakePHP app?
I am having trouble figuring out how to structure this. Here is my app:
It is a games website...say the games are "word search", "sodoku", and "crossword puzzle".
Each game has many puzzles. So there are 100 or so different word searches to play,…

Nick Manning
- 2,828
- 1
- 29
- 50
1
vote
1 answer
Aggregation of an expression in Django query spanning multiple tables
Is it possible to compute an aggregation (ex.: sum) of an expression (ex.: subtraction) of fields from a related table in a Django ORM query?
For a full example of what I'm trying to achieve, see this working SQL Fiddle. I broke it down into two…

mgibsonbr
- 21,755
- 7
- 70
- 112
1
vote
1 answer
SQL generate a row automatically on table2, when a row is inserted to table1
I have the next table structure:
Users:
columns: user_id, ...
Users_Skins:
columns: user_id, ...
I want that if a users registers (Users is being populated), it will automatically add a row on Users_Skins with the user_id of the Auto Increment,…

Novak
- 2,760
- 9
- 42
- 63
1
vote
2 answers
Multi level associations in rails
I am creating an application to track football teams through out the season. but i am stuck on the design of the database. One fixture has a home team and an away team. I have created a fixture model which has two foreign keys- home_team and…
chris