Select from multiple tables without a join?

后端 未结 8 1117
轻奢々
轻奢々 2020-12-05 01:53

What is the easiest way to select data from two tables and rather than join them, have them appear as separate rows. Both tables have similar or matching fields and I want t

相关标签:
8条回答
  • 2020-12-05 02:18

    select 'test', (select name from employee where id=1) as name, (select name from address where id=2) as address ;

    0 讨论(0)
  • 2020-12-05 02:21

    In this case we are assuming that we have two tables: SMPPMsgLogand SMSService with common column serviceid:

    SELECT sp.SMS,ss.CMD 
    FROM vas.SMPPMsgLog AS sp,vas.SMSService AS ss 
    WHERE sp.serviceid=5431 
    AND ss.ServiceID = 5431 
    AND Receiver ="232700000" 
    AND date(TimeStamp) <='2013-08-07' 
    AND date(TimeStamp) >='2013-08-06' \G;
    
    0 讨论(0)
提交回复
热议问题