sql语句 查询 - 其他数据库开发 / MySQL/Postgresql
SQL code:
select count(subid) as subnum,st.id,t.title,t.content from subtopics st JOIN topics t ON st.id=t.id
where st.id in (select id from topics where viewid='1')
group by st.id
我的链接条件 为t.id=st.id 但t.id对应的st.id有可能没没有 但我想显示t 表 的内容 SQL语句怎么写
select count(subid) as subnum,t.* from subtopics st right outer JOIN topics t ON t.id=st.id
where t.id in (select id from topics where viewid='1')
group by t.id
order by date desc
我也试出来了 还是谢谢大家 O(∩_∩)O~
相关问答:
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......
字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......
我是个新手,望高手解答
我现在已经安装了mysql,也有mysql的jdbc。但我怎么配置后,才能在MyEclipse里操作mysql呢?请高手说详细点
打开Myeclipse----window---open perspective---MyEclipse database explorer-- ......
求个vb中的sql语句的写法,次sql语句的用法是分页程序
我写的如下:其中A是用来接收每页显示的记录的条数,B是用来接收显示的当前的页面.
sqltext="select top A * from log where id not in(select top ( ......