设为首页
收藏本站
开启辅助访问
切换到窄版
登录
立即注册
中问网首页
我的收藏
站长博客
搜索
搜索
本版
帖子
用户
第一问答网
»
论坛
›
中问网
›
问答
›
SQL 问题
返回列表
发新帖
SQL 问题
[复制链接]
11
|
4
|
2011-6-29 09:12:34
|
显示全部楼层
|
阅读模式
现有表A如下:
id
title
num
sum
1
北京
1
0
2
武汉
2
0
3
南京
2
2
4
上海
1
0
5
重庆
1
0
现在需要查询 num=1 并且sum =0的所有 数据 并且返回结果排序为order by id asc
这个SQL语句该怎么写 小白求教
string sql = "select *from Columns where Column_ids =" + id + "and Channel_id=" + Channel_id + " order by Column_id ase";
提示ase 附近有语法错误 Column_ids id Channel_id Column_id 均为int型
回复
使用道具
举报
千问
|
2011-6-29 09:12:34
|
显示全部楼层
select * from 表名 where num=1 and sum=0 order byn id asc把表名换成你要的表名就可以...
回复
使用道具
举报
千问
|
2011-6-29 09:12:34
|
显示全部楼层
string sql = "select * from Columns where Column_ids =" + id + " and Channel_id=" + Channel_id + " order by Column_id asc";注意空格,上面报的语法错误是因为你写错单词了。升序是asc,降序是desc...
回复
使用道具
举报
千问
|
2011-6-29 09:12:34
|
显示全部楼层
select* from A where num=1 and sum=0 order by id asc...
回复
使用道具
举报
千问
|
2011-6-29 09:12:34
|
显示全部楼层
string sql = "select * from Columns where Column_ids =" + id + " and Channel_id=" + Channel_id + " order by Column_id asc";...
回复
使用道具
举报
返回列表
发新帖
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
立即注册
本版积分规则
发表回复
回帖后跳转到最后一页
千问
主题
0
回帖
4882万
积分
论坛元老
论坛元老, 积分 48824836, 距离下一级还需 -38824837 积分
论坛元老, 积分 48824836, 距离下一级还需 -38824837 积分
积分
48824836
加好友
发消息
回复楼主
返回列表
问答
热门排行