A. sql搜索語句,結果為空
1、你的程序裡面沒看見CONN的定義
2、search=trim(request.queryString("search"))你所有的SQL條件都與這個有關,所以你在查詢前 先Response.Write 看看search是否有值
B. sql語句查出的數據為空,怎麼用個if語句判斷,然後作出處理
可以實現,以sql server為例看:
if not exists(select userName from food join diningcar on food.foodId=diningcar.foodId join users on diningcar.userId=users.userId where (comment=0 or comment=-1) and userName='zq' group by userName)
select 0,'zq'
else
select sum(price),userName from food join diningcar on food.foodId=diningcar.foodId join users on diningcar.userId=users.userId where (comment=0 or comment=-1) and userName='zq' group by userName
方法二:
select isnull(sum(price),0),userName
from food join diningcar on food.foodId=diningcar.foodId
join users on diningcar.userId=users.userId
where (comment=0 or comment=-1) and userName='zq'
group by userName
不知道是不是你想要的結果,但是我有個疑問,你為什麼不在程序里進行判斷,而是要讓sql語句判斷呢?
C. sql查詢為什麼查不出結果,查出來是空的
語法錯了,什麼都找不到,當然為空
應該是
SELECT * FROM Users WHERE real_name LIKE '%王%'
原因:(2個百分號,是單引號)
D. sql用變數做欄位查詢為什麼查詢是空的
這樣查詢肯定是空的,相當於條件為'name'
=
'123456'
象這樣的要用動態sql
來執行
如
declare
@sql
varchar(200)
set
@sql
=
'select
*
from
news
where
'
+
@name
+
'
=
'''
+
@ifvalue
+
''''
exec(@sql)
E. 為什麼這條sql 只能查出一條數據而且是空的 求大牛指點
這個語句這么寫是沒有錯誤的,可能的原因
A.goods_sn=B.goods_sn ,goods_sn列在A,B表中沒有相等的,
A.goods_sn=B.goods_sn ,goods_sn列在A,B表中有相等的,但是你的WHERE條件
A.goods_id>389058and A.goods_id<390308; 將相等的部分過濾了。
所以沒有查詢出來數據。
F. SQLQuery查詢結果為空,這是怎麼回事
你好,
檢查你的查詢資料庫表中是否有對應的查詢數據。
檢查你的代碼是否有問題,即調用方法的過程是否存在異常。是否在程序還沒有返回查詢結果的時候就已經關閉了資料庫連接。
檢查你的DB類書寫是否正確。
希望對你有所幫助!
G. sql server中列中有數但查詢返回為空
和你的查詢條件有關系,檢查where後年的條件。
另外,你還需要確認連接的資料庫、使用的資料庫,是否是你的目標資料庫,避免因為連錯資料庫出現失誤
H. 為什麼sql跑出來 null和空
因為被設置的欄位允許為空,所以才有了null
但是如果你想不顯示這個null,可以採用isnull的方式來處理
比如
select isnull(欄位名,0) from 表名
就是說如果這個為空,則把它顯示為0,這個0當然也可以替換成其他字元或數字
I. 為什麼SQL查詢表的結果是空的 SQL sever求解!在線等
因為你的s表中的sid和sc表中的sid沒有相同的,故返回的為空集
J. SQL語句錯在哪裡,為什麼查詢到的結果是空的
語句沒語法上的錯誤
但是造成這種原因的可能有幾種
1,兩個表的欄位類型不同
2,有可能ipaddress 或 ip 這兩個欄位在某個位置上有空格,這樣就造成你看著其實相等,但是其實因為多一個或少一個空格,其實並不相等
你還是檢查一下數據吧