I have 2 tables; table A and table B
我有2张桌子;表A和表B.
Table A has 3 columns; a, b, c Table B has 2 columns; d and e
表A有3列; a,b,c表B有2列; d和e
I want to select IF A.b is NOT NULL THEN SELECT A.b ELSE IF A.b IS NULL THEN SELECT B.d
我想选择IF A.b是非NULL然后选择A.b ELSE如果A.b IS NULL那么SELECT B.d
any help please
请帮忙
I just made up this example, but if required then say A.a and A.c are unique ids.
我刚刚编写了这个例子,但如果需要,那么说A.a和A.c是唯一的ID。
1 个解决方案
#1
0
Give it a try!
试试看!
// select data from your database
//从数据库中选择数据
Select * From TABLE_A
选择*来自TABLE_A
if((A.a != "") || (A.a != NULL)){
// select d from table B
} else {
// echo records from your column B
}
#1
0
Give it a try!
试试看!
// select data from your database
//从数据库中选择数据
Select * From TABLE_A
选择*来自TABLE_A
if((A.a != "") || (A.a != NULL)){
// select d from table B
} else {
// echo records from your column B
}