Questions tagged [table-relationships]

220 questions
0
votes
1 answer

Laravel Eloquent ORM: trouble with one-to-many using belongs_to()

I'm having trouble accessing a relationship in Laravel. Relevant to this question, I have two tables, messages and users. The messages table looks like: Messages: id, user_from, user_to, read, message, created_at, updated_at The users table looks…
wnajar
  • 747
  • 1
  • 7
  • 27
0
votes
1 answer

MySQL Constraints/Cascades: Will This Work?

I have a table - threads - and another - posts. Each thread is like a subject with the posts being replies. If a thread is deleted, all related posts need to be deleted. All posts have an id and a thread_id field. Here's what I have, just wondering…
user1607759
0
votes
1 answer

yii- help using many-many relationship

All, I need to get a table value based on the primary key from it table then I used that on the other table. I can ilustrate my question like this: table a id_a att_a1 att_a2 att_a3 att_a4 att_a5 table b (dummy table) …
0
votes
1 answer

MySQL: Difference between relating and not relating tables

I have 2 tables: "catalog" and "press" being "press" the child table and I have them related by id_catalog (pointing to "id" in catalog) inside "press". I managed to get one field on catalog ("name") and their "press" childs like this for testing…
Ariel Noname
  • 31
  • 1
  • 5
0
votes
1 answer

Trouble with table relationships within Access

I am creating a project where Teachers enter a students coursework grades and it does various reporting on that data. It is for a course where there are many units and within those units are many assessment objectives that the students can meet to…
Robin L
  • 177
  • 3
  • 3
  • 12
0
votes
1 answer

CakePHP find Queries with aliases SQLSTATE[42S22] Error

I'm having a weird problem with my relationships/aliases in CakePHP and now its preventing me from accessing my data correctly. I have: User hasMany CreatorModule (alias for Module) User HABTM LearnerModule (alias for Module) Module belongsTo…
ahjohnston25
  • 1,915
  • 15
  • 36
0
votes
2 answers

Hibernate relation to jointable

I have a problem with Hibernate. I have three tables jobs, actions and mails. For jobs and actions there is a many-to-many relationship. So I created a join-table Action_Jobs which contains the ids of both tables. Now, how can I build a relationship…
rawshell
  • 3
  • 3
0
votes
1 answer

In rails what is the syntax to access records in a column of a join table?

I have: class Student < ActiveRecord::Base #attr_accessible :lastname, :name has_many :together has_many :teachers, :through => :together end class Teacher < ActiveRecord::Base #attr_accessible :lastname, :name has_many…
Brian Joseph Spinos
  • 2,144
  • 2
  • 18
  • 18
0
votes
1 answer

object relationships and passing object ids to multiple controllers?

I am in a pickle on the best way to do something and would appreciate some advice. I have the following models: class Plan < ActiveRecord::Base attr_accessible :description, :name, :user_id validates :name, :presence => true end class…
vlwills
  • 105
  • 1
  • 7
0
votes
3 answers

Select rows from two tables in sql

I am having three tables which has primary keys and references. I need to select the rows in below way. Please any one help me. Table: Class (ClassId -> primarykey) ClassId ClassTitle -------------------- 1 First 2 Second 3 …
Karthik Kumar
  • 13
  • 1
  • 1
  • 3
0
votes
1 answer

SQL - Table Relationships, Primarily (PK/FK)

I am new to SQL and I have a question regarding table relationships. Currently, I have the following tables in my database: Person: Person_ID (PK) Name Company_ID(FK) Phone Email Company: Company_ID (PK) Name Address City State Invoice_ID…
Dom
  • 38,906
  • 12
  • 52
  • 81
0
votes
7 answers

How can I create multiple columns from one DB Field in SQL Server?

I have a field called PropertyValue in the UserProfile table that can contain information for address, phone number, first name, last name, user name, city, etc... each record in this table is associated to a user by UserId, it is also associated to…
Matt
  • 5,547
  • 23
  • 82
  • 121
0
votes
2 answers

how to know if my database relationship is/isnot ok?

how can i find out if my database design (specially relationships) are ok? i found some database examples on the internet and tried to solve them but my design is always different than the examples design. is there a any rules to follow when…
Pouria P
  • 565
  • 1
  • 8
  • 21
-1
votes
1 answer

How to persist such data in mysql

I have the following 5 classes [other attributes and methods have been skipped] CommonInterface.java import java.util.Vector; public class CommonInterface { public Vector myDescription; public Vector myPartyPlaceThing; …
-1
votes
1 answer

How to correctly maintain database schema in rails?

I have schema like this: create_table "grades", force: :cascade do |t| t.integer "cls" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "post_grades", force: :cascade do |t| t.integer…
1 2 3
14
15