Yii Framework Forum: How to get the name in a mysql view? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

How to get the name in a mysql view? Rate Topic: -----

#1 User is offline   erand 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 136
  • Joined: 10-December 14

Posted 16 December 2014 - 08:14 AM

Hi all,

I have a mysql query (UNION of 4 tables). I display this view to the user. How do I display the name and not the ID to the user? I mean this view has no "relations" (fk or whatsoever) so how do I access the name? Eg:

TableA
-idA
-name
-a1
-a2
...

TableB
-id
-idA
-b1
-b2
...
-common

TableC
-id
-idA
-c1
-c2
...
-common

In my view lets say:

SELECT idA FROM TableB WHERE common=0;
UNION
SELECT idA FROM TableC WHERE common=0;

When I show this view to the user, how do I display "name" from tableA (not idA)?
0

#2 User is offline   oligalma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 419
  • Joined: 07-April 12
  • Location:Spain

Posted 19 December 2014 - 09:12 PM

http://dev.mysql.com...0/en/union.html
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users