-1

Recently, I've been working on a simple recording archival system, done with PHP and MySQL.

Basically, you register and login to the website and you can add, edit and delete recordings (aka metadata). Here's the current database situation:

enter image description here

My problem is the following: when I populate a table on the website and call "user" from "assets", it returns me a number from "usersId". I want "users" to return "usersUid" instead, but staying connected to "usersId". Is that even possible or should I just connect "user" directly "usersUid"?

Dharman
  • 30,962
  • 25
  • 85
  • 135
O Tal Antiquado
  • 283
  • 1
  • 2
  • 9

1 Answers1

0

Is this a raw query or you are using some ORM, if that's a raw query then simply a join and select would work fine. like this:

select usersUid from assets as a inner join user as u on u.usersId = a.user

and if you are using ORM of any sort you'll find some alternative to implement the above join.

NOTE: Please change the join according to the need. Below is a reference for the same.

Joins in MySQL

Dharman
  • 30,962
  • 25
  • 85
  • 135
cupid22
  • 161
  • 7