查詢MYSQL同資料庫2張表的不同字段值語句怎麼寫

2021-03-12 01:03:50 字數 1329 閱讀 5146

1樓:匿名使用者

select log.*,student.name from log left join student on log.

id= student.id and log.tim=student.

tim;

這個是bai用的du左聯合

zhi的方

dao式

版也可以

權select log.*,student.name from log,student where log.

id= student.id and log.tim=student.

tim;

2樓:匿名使用者

select

t1.id, t1.tim, t1.ran, t2.namfrom log t1, stunt t2where 1=1

and t1.id = t2.id

and t1.tim = t2.tim

有問bai題du

,請zhi追dao問版。權

3樓:鈕通樂正思淼

呵呵,已經解決了。先插入order表,再呼叫php函式

:mysql_insert_id

()(獲取剛插入資料的自增id)就可以。

mysql如何同時查詢乙個欄位的兩個不同值的資料的最後一條資料

4樓:匿名使用者

--第一種寫法

select * from 表名 where deveui='3430363057376506' or deveui='3430363064378607'

--第二種寫法

select * from 表名 where deveui in('3430363057376506','3430363064378607')

查詢mysql同乙個資料庫2張表的不同字段值語句怎麼寫

5樓:德陽小孩

查詢兩張表的不

來同欄位,一般

自通過連線(join)來實現,需要兩張表有能夠相互關聯的字段。

如果沒有任何關聯字段,直接查兩個字段的話,就會出現笛卡爾積(結果為t1和t2欄位的集合,結果條數為t1*t2)。

假設你的需求是兩張表有關聯欄位id,以內連線為例,則sql可以寫為:

select t1.c1,t2.c2 from t1 inner join t2 on t1.id=t2.id;

6樓:匿名使用者

select a.*,b.* from a a,b b where a.name = b.name

mysql資料庫查詢的問題,mysql 資料庫查詢的乙個問題

select from select t.num if category id t.category id,num 1,1 as cal rank,category id t.category id from select from goods order by category id asc go...

C連線mysql資料庫無法讀取資料庫表中資訊求大神指點

資料庫是否有資料?你的data source localhost user id root password 有有沒有錯誤 try這裡,看是執行到哪一步報錯了 大師們幫我看看這個問題怎麼解決,c 中把資訊寫不進mysql資料庫!你先檢查sql語句有沒有戳錯 檢查方法是先在資料庫裡面執行一遍 再cop...

MySQL資料庫查詢問題,高分求解

誰想念月 select class,count sign date as 簽到數,count sign date count name as 簽到率 from table group by class 是勇敢 知識點 group by 彙總函式 sum count函式 難點 多條件彙總 答案 百分比...