if statement - Selecting data from 2 different tables depending upon the conditions; mySQL -


i have 2 tables; table , table b

table has 3 columns; a, b, c table b has 2 columns; d , e

i want select if a.b not null select a.b else if a.b null select b.d

any please

i made example, if required a.a , a.c unique ids.

give try!

// select data database

select * table_a

if((a.a != "") || (a.a != null)){   // select d table b   } else {  // echo records column b   } 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -