社区
疑难问题
帖子详情
高分求购sql语句
HndyLiu
2003-11-19 03:18:59
表table
子段:id pid morder
1 0 1
2 1 1
3 1 2
4 0 2
5 0 3
需求:从表table里读出pid=0的所有记录,并且将所有pid=id.value全部读取出来,并按照morder排序
...全文
20
11
打赏
收藏
高分求购sql语句
表table 子段:id pid morder 1 0 1 2 1 1 3 1 2 4 0 2 5 0 3 需求:从表table里读出pid=0的所有记录,并且将所有pid=id.value全部读取出来,并按照morder排序
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
11 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
monkeys
2003-11-19
打赏
举报
回复
select * from table order by pid,id
wzh1215
2003-11-19
打赏
举报
回复
没有问题,有问题就可能是类型的问题了!
create table #table(id int,pid int,morder int)
insert #table values(1,0,1)
insert #table values(2,1,1)
insert #table values(3,1,2)
insert #table values(4,0,2)
insert #table values(5,0,3)
select * from #table where pid=0
union all
select * from #table where pid=id
order by morder
HndyLiu
2003-11-19
打赏
举报
回复
谢谢大家,
wzh1215(四脚蛇) ( )
select * from table where pid=0
union all
select * from table where pid=id
order by morder
语句报错:=号附近有语法错误
wzh1215
2003-11-19
打赏
举报
回复
select * from table where pid=0
union all
select * from table where pid=id
order by morder
HndyLiu
2003-11-19
打赏
举报
回复
对啊
pid=0为主力
pid=id的值的为 它的替补
现在需要:将主力提取,并将它对应的替补放在它随后
brook_huang
2003-11-19
打赏
举报
回复
select * from table wher pid<>0
brook_huang
2003-11-19
打赏
举报
回复
pid=id.value?
select * from table wher pid=0 order by morder
sunshareforever
2003-11-19
打赏
举报
回复
select * from table where id = pid and pid = '0' order by morder
HndyLiu
2003-11-19
打赏
举报
回复
读取所有PID=0的记录:select * from table wher pid=0
读取所有PID记录不为0的记录
HndyLiu
2003-11-19
打赏
举报
回复
select * from table wher pid=0
select * from where pid in (select * from table wher pid=0)
zjcxc
2003-11-19
打赏
举报
回复
--什么意思?
select * from table wher pid=0
【②MySQL 】:测试数据准备、
SQL语句
规范与基本操作
MySQL 数据库实用指南:测试数据准备、
SQL语句
规范与基本操作
一条
sql语句
查出男生前5名和女生前五名
要求用一条
sql语句
查出男生前5名和女生前五名 select * from t_stu a where 5>(select count(*) FROM t_stu where gender=a.gender AND grade>a.grade) order by a.grade desc 对这个sql的理解是 对于每
sql 语句的limit的用法
sql 语句的limit的用法 SELECT * FROM table LIMIT [offset,] rows | rows OFFSET offset mysql> SELECT * FROM table LIMIT 5,10; // 检索记录行 6-15 //为了检索从某一个偏移量到记录...
基础类 -
SQL语句
基础类 -
SQL语句
<br />转载请标明出处: http://blog.csdn.net/hz/archive/2006/03/01/613376.asp 本文来自 CSDN 博客。x sql server 怎么跨库查询? 如何判断字符的大小写 ? 如何...
实验2 使用T-SQL编写程序
实验2 使用T-SQL编写程序 【实验目的】 1)掌握常用函数的使用方法。 2)掌握流程控制语句的使用方法。 【实验环境】 SQL Server 2012 Express(或SQL Server 2017 Express) 【实验重点及难点】 1)应用...
疑难问题
22,209
社区成员
121,730
社区内容
发帖
与我相关
我的任务
疑难问题
MS-SQL Server 疑难问题
复制链接
扫一扫
分享
社区描述
MS-SQL Server 疑难问题
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章