由买买提看人间百态

topics

全部话题 - 话题: desc
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
aw
发帖数: 127
1
来自主题: BuildingWeb版 - ASP SORT 一问.
不难。加6个HIDDEN INPUT FIELDS和一个VB SCRIPT FUNCTION就可以了。
FIELD1 用来存ORDERBY (PROJECT,。。。)
2-5分别存当前各FIELD的值,来回变(ASC,DESC)就行了。
在LINK上CALL SCRIPT FUNCIION来改变当前值。
不过你们现在的这种DESIGN不大好,换一种排序就得重新来回跑一次,用XML/XSLT好得多


这些FIELD




s*****r
发帖数: 847
2
来自主题: CS版 - 问个php代码的问题
colspan="2">订单金额: $currency; ?> strong> colspan="2">邮费: currency; ?>阅读全帖
x********o
发帖数: 31
3
来自主题: Database版 - dummy question

absolutely. to the tables you owned, u can easily attain it by a query.
but to the server users, you need administrator's privilege.
the sql should be:
ttitle left 'OBJECTS OWNED BY 'sql.user
column object_name format a64 heading 'Object Name'
column object_type format a15 heading 'Type'
select object_type, object_name
from user_objects
order by object_type desc, object_name;
ttitle off
d*t
发帖数: 7
4
来自主题: Database版 - primary key?
just desc ;
b****e
发帖数: 1275
5
来自主题: Database版 - SQL question
select top 10 id from test order by id desc
f*******h
发帖数: 1269
6
来自主题: Database版 - Special character in insert values
When I:
INSERT INTO mytable(name, desc) VALUES('Test Name', 'It's a good test')
this will cause problem, because ' after It.
How could I do?
p*****e
发帖数: 58
7
来自主题: Database版 - Special character in insert values

INSERT INTO mytable(name, desc) VALUES('Test Name', 'It''s a
good test')
use '' (two single quote) for '. SQL uses ' as the escape
charactor like the \ in C/C++, or " in VB.
e***e
发帖数: 351
8
来自主题: Database版 - 请教一个问题
在Oracle Database 中,如何得到某个table 各个Column的description以及
table与table间的reference关系? 用Desc只能得到每个Column的名称,数据类型
以及是否能为空。
多谢!!
B**z
发帖数: 153
9
来自主题: Database版 - SQL问题
try try this,
select * from A where id in
(
select Aid from B group by Aid
)
order by
(select count(*) as ct from B where
B.Aid=A.id)
desc
k*******d
发帖数: 237
10
来自主题: Database版 - SQL问题
Select A.*, count(*) as ShowTimes
from A join B on A.id=B.Aid
group by A.*
order by ShowTimes desc
C****n
发帖数: 2324
11
来自主题: Database版 - 纪录查找问题
First of all, you must realize that go to the last record in SQL is VERY VERY
expensive, don't do it if you REALLY have to.
What you can do is using: ORDER BY something DESC, then work as usual.
Calvin

在数据库中,对一个表进行记录处理一般是从头到尾的顺序,有没有办法打开一个cursor
g***r
发帖数: 281
12
来自主题: Database版 - 请教Oracle高手一个OCI的问题
I found a weird problem in OCI bulk insert. It failed if client locale
setting is different from DB server. my DB server locale is
NLS_LANG=AMERICAN_AMERICA.ZHT16BIG5 and the table is very simple:
SQL> desc foo
Name Null? Type
ak
发帖数: 512
13
来自主题: Database版 - column in table point to another table
question: how to create a column in one table which points to another table?
for example:
column(premises) in table data_rules has its type : rule_type,
rule_type is another table. (see the following two tables).
i saw these two table, but i do not know how create premises
and let it has type(rule_type which points to another table).
would you please write the command for me? thanks!
SQL> desc data_rules;
Name Null? Type
----------------------------------
s*******e
发帖数: 151
14
来自主题: Database版 - oracle中如何查询已建立的表结构
select table_name from user_tables;
desc table_name;
you could use "drop" to 删除 已经建立的表等等。
n********a
发帖数: 68
15
来自主题: Database版 - How to write this SQL? Urgent!!!
The question can be interpreted by different ways.
I took it mean that find the lastest four dates and
give me every position.
In Oracle 8.1.6 upper, you could do:
select pName from (
select position.pName,
dense_rank() over (order by EP.tDate desc nulls last) dr
from EP, Position
where EP.pID=position.pID and Position.state='Illinois'
) where dr <= 4;
If your database supports inline view and rownum, you could do
select pName from (
select position.pName
from EP, Position
where EP.pID=position.
D****N
发帖数: 430
16
来自主题: Database版 - Help about a SQL statement
SELECT TOP 1000 *
FROM table_blah
WHERE
table_uid IN (SELECT TOP 2000 table_uid
FROM table_blah)
ORDER BY table_uid DESC
h*********s
发帖数: 14
17
来自主题: Database版 - Chained full outer join in oracle 9
Hi there,
I have a werid problem for chained full outer join in oracle.
I have following three tables:
SQL> desc part
Name Null? Type
----------------------------------------- -------- -----------------
PART_ID NOT NULL VARCHAR2(4)
SUPPLIER_ID VARCHAR2(4)
SQL> select * from part;
PART SUPP
t*******y
发帖数: 57
18
来自主题: Database版 - servlet调用sql 访问oracle的问题
这几天真是见了鬼了
在Linux下单独写个standalone的java程序用JDBC访问oracle一点问题都没有
换写成servlet来通过JDBC访问oracle竟然只能做"select .."这样的sql访问
用什么insert/update/desc之流的sql命令通通给我出错,
说什么java.sql.SQLException: SQL string is not Query
ft,明明直接把那些sql命令放入sqlplus执行和放在standalone的java程序里面
执行一点问题都没有.google了半天没有啥结果.
这个到底啥原因有人知道么?难道用servlet调用jdbc数据库还有权限限制?
用perl写的cgi调用数据库也一点问题都没有呀.
t********k
发帖数: 808
19
oracle.sql.ArrayDescriptor desc =
oracle.sql.ArrayDescriptor.createDescriptor("VARRAY1", con);
oracle.sql.ArrayDescriptor descriptor =
oracle.sql.ArrayDescriptor.createDescriptor("TYPEVARCHARARRAY",con);
上面二句都会抛出java.lang.ClassCastException异常为什么呢?要对Oracle的连接有什么要求?
我完全是按照老一辈无产阶级革命家Tom的指导下做的
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:8908169959941
为什么别人能通过,我确有问题呢?
其中二个类型的定义是这样的
create type TYPEVARCHARARRAY as varray(10) of varchar2(20);
CREATE TYPE varray1 AS VARRAY(10) OF
t********k
发帖数: 808
20
我按Tom在Oracle上用java写了个java类
在这个类中执行
oracle.sql.ArrayDescriptor descs = oracle.sql.ArrayDescriptor.createDescriptor("TYPEVARCHARARRAY",con);
一点问题也没有
但在我的应用中执行这句却出出错
天理何在啊
Q**g
发帖数: 183
21
来自主题: Database版 - 请教一个SQL Query
嗯,刚才在mysql里调过了。假设你想知道player table里的name。如果还想要别
的,一并填进去就是了。如果啥都不要,只想知道(player1, player2, count(gameid)
的话,就根本不用join了
select g.player1, g.player2, p1.name, p2.name, count(g.gameid) as counts
from game g, player p1, player p2
where g.player1=p1.playerid and g.player2=p2.playerid
group by g.player1, g.player2, p1.name, p2.name
order by counts desc
y********o
发帖数: 2565
22
来自主题: Database版 - 怎么设置多个用户 (Oracle 10g)?
MySQL里面有不同的databases, 比如你可以 show databases 得到一个数据库名称列表
。在Oracle里面与此相对应的是叫做tablespace吗?
假设我是DBA, 对数据库myTestDB有绝对权限。我想创建几个其他用户,让他们对
myTestDB只有read only权限。
我这样试了一下:
create user johndoe
default tablespace myTestDB
identified by thepassword
temporary tablespace temp;
然后我说
grant create session to johndoe;
grant select on myjunktable to johndoe;
grant select on anotherjunktable to johndoe;
结果不对,好像johndoe被另立门户成了一个独立的database。瞧:
SQL> desc myjunktable;
ERROR:
ORA-04043: object myjunktable does not exist
y********o
发帖数: 2565
23
来自主题: Database版 - Oracle database link problem
对,我将学校那个Oracle10g的tnsnames.ora中相关的一节如下搬到我的XE之tnsnames.
ora了。
Oracle10g =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle10g.my.univ.edu)(PORT = 1521)
)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = Oracle10g.my.univ.edu)
)
)
然后我说:
SQL> create database link mylink connect to johndoe identified by wassupman
using 'Oracle10g';
Database link created.
SQL> desc mytable@mylink;
ERROR:
ORA-12170: TNS:Connect timeout occurred
我按这个 h
y********o
发帖数: 2565
24
来自主题: Database版 - Oracle database link problem
测试如下:
sqlplus /nolog
SQL> connect scott/tiger@Oracle10g
Connected.
SQL> desc user_tables;
Name Null? Type
------------------------ -------- -----------------------
TABLE_NAME NOT NULL VARCHAR2(30)
TABLESPACE_NAME VARCHAR2(30)
CLUSTER_NAME VARCHAR2(30)
IOT_NAME VARCHAR2(30)
[snip]
SQL>
y********o
发帖数: 2565
25
来自主题: Database版 - To get the 2nd, 3rd, 4th largest value
It is pretty easy to get the largest value of a field. e.g.:
select max(salary) from employees;
How do you get the 2nd largest value? Or the 3rd largest?
Do this:
select salary, rn from
(select salary, row_number() over (order by salary desc) rn
from employees) x
where rn=2;
q**1
发帖数: 193
26
来自主题: Database版 - To get the 2nd, 3rd, 4th largest value
这个在mysql里面比较简单(选第3个):
select salary from employees
order by salary desc
limit 2,1;
q**1
发帖数: 193
27
来自主题: Database版 - To get the 2nd, 3rd, 4th largest value
I dont have Oracle, but can you use a query like:
select salary from employees
order by salary desc
where rownum = 2;
c**t
发帖数: 2744
28
来自主题: Database版 - To get the 2nd, 3rd, 4th largest value
in sql server:
select top 5 x.*
from (select distinct salary from employees order by salary desc) x
s**o
发帖数: 584
29
来自主题: Database版 - To get the 2nd, 3rd, 4th largest value
Actually it is not. Rownum are a pseudocolumn (not a real column). It will
be available after the query statement is processed. You may try this query
to get your result.
select *
from ( select e.*, rownum rnum
from ( select emp.*
from emp
order by salary desc ) e
where rownum <= 2
)
where rnum = 2;
x***e
发帖数: 2449
30
来自主题: Database版 - To get the 2nd, 3rd, 4th largest value
probably you can NOT in SQL Server.
The best might be
select top 5 salary
from [table name]
group by salary
order by salary desc
x***e
发帖数: 2449
31
来自主题: Database版 - To get the 2nd, 3rd, 4th largest value
should be:
select top 5 x.*
from (select distinct salary from employees) x
order by salary desc
w*******e
发帖数: 1622
32
来自主题: Database版 - To get the 2nd, 3rd, 4th largest value
你这是把前五个都按desc给了, 人是要2~4位的
E**i
发帖数: 116
33
☆─────────────────────────────────────☆
yiyayiyayo (Mera naam Itiaan hai) 于 (Wed May 16 23:34:48 2007) 提到:
It is pretty easy to get the largest value of a field. e.g.:
select max(salary) from employees;
How do you get the 2nd largest value? Or the 3rd largest?
Do this:
select salary, rn from
(select salary, row_number() over (order by salary desc) rn
from employees) x
where rn=2;
☆─────────────────────────────────────☆
q101 (^(?:[DX]?HT|X|YA)ML$) 于 (Wed May 16 23:44:23 2007) 提到:
t*****g
发帖数: 1275
34
SELECT t1.id_student, t1.id_class, t1.grade,
(SELECT count(*) + 1 from mytalbe t2 WHERE t2.id_class = t1.id_class and t2
.grade > t1.grade)
FROM mytable t1 order by t1.id_class, t1.grade desc;
t**********s
发帖数: 930
35
谢谢!
我又加了相同成绩并列名次的处理.
SELECT S.ID_STUDENT, S.ID_CLASS,S.GRADE, COUNT(*) AS RANK FROM STUDENTS AS S
LEFT OUTER JOIN STUDENTS AS S1 ON S.ID_CLASS = S1.ID_CLASS AND (((S.GRADE =
S1.GRADE) AND (S.ID_STUDENT=S1.ID_STUDENT)) OR (S.GRADE < S1.GRADE) ) GROUP
by S.ID_CLASS, S.GRADE DESC, S.ID_STUDENT;

t2
c***r
发帖数: 65
36
select ......,row_number() over (partition by 班号 order by 成绩 desc) as
rank from xxx
B*****g
发帖数: 34098
37
来自主题: Database版 - 请问sql这个querry怎么写
除了oracle好像都可以用top。
oracle先排序再用rownum。
比赛应该比其他容易,因为基本上不会有同时比赛的。
oracle:
SELECT MAX(score)
FROM (SELECT score
FROM (SELECT NVL(score,0)
FROM table
WHERE NVL(playtime, 0) > 0
AND playdate IS NOT NULL
ORDER BY playdate DESC)
ROWNUM <= 10)
B*****g
发帖数: 34098
38
1. yes. But why not test yourself to confirm your sql. btw, I think distinct
is unnecessary.
2. Create temp table use for both?
3. I will do this in oracle
SELECT NAME
FROM (SELECT NAME,
RANK () OVER (PARTITION BY title ORDER BY age DESC) AS
agetitlerank
FROM table)
WHERE agetitlerank = 1
m*****h
发帖数: 18
39
来自主题: Database版 - how to write this query
I have 2 tables, classes and classSchedules
Classes table has the following columns: ClassID, Title, Description, Length
, Price.
ClassSchedule table has ScheduleID, ClassID, StartDate.
I need a query to return the result shown below
Title Description StartDate Length Price
Class 1 desc. For Class 1 9/1/2008 5 days $1,000
B*****g
发帖数: 34098
40
desc DBMS_STATS
n****u
发帖数: 229
41
Sorry to bother high hands again. Thanks for your help before!
Table a, articleid (pk), userid, datetime, textbody
Table b, userid (pk), nickname
I want one record, that's the latest article, with nickname, datetime and
textbody.
So I wrote this:
SELECT a.DateTime,b.Nickname,a.textbody
FROM a, b
WHERE a.userid=b.userid
ORDER BY datatime DESC
LIMIT 0, 1
But I feel this might be slow. Any way to make it fast?
I told my team leader we should write this as a stored procedure, but he
refused.
c*******e
发帖数: 8624
42
来自主题: Database版 - 急问一个关于T-SQL的问题,谢谢
you can do a qualify here
select a.whatever ,
b.whatever
from table_a a
left outer join table_b b
on a.id = b.id
qualify row_number() over (partition by a.id order by b.dt desc) = 1
j*****n
发帖数: 1781
43
I thought TOP is only for T-SQL...
if it does, sure you will get the top 10 highest salary records, because the
result set is sorted.
n********6
发帖数: 1511
44
Ok. Since top is not available in Oracle, let me do in this way.
1. SELECT *
INTO TempTable
FROM PAYROLL
WHERE Salary = (SELECT MAX(SALARY) FROM PAYROLL)
And ID NOT IN (SELECT ID FROM TempTable)

2. SELECT Count = COUNT(*) FROM TempTable
3. Loop 2.3., when Count > 10, exit
B*****g
发帖数: 34098
n********6
发帖数: 1511
46
Ok. Since top is not available in Oracle, let me do in this way.
1. CREATE TABLE TempTable
AS SELECT
FROM PAYROLL
WHERE Salary = (SELECT MAX(SALARY) FROM PAYROLL)
And ID NOT IN (SELECT ID FROM TempTable)

2. SELECT Count = COUNT(*) FROM TempTable
3. Loop 2.3., when Count > 10, exit
B*****g
发帖数: 34098
47
来自主题: Database版 - 问一个关于SQL的问题
Your code seems not work.
Finally got time to do it, it is harder than I expected. My code is still
need to be reviewed.
select A.group_id, A.parent_nod AS "max_lvl_parent"
from (
SELECT G.group_id, T.parent_nod,T.parent_lvl,
ROW_NUMBER() over (partition by G.group_id order by T.parent_lvl desc) Lvl_
Rank
FROM [Group] G, Tree T
WHERE G.node = T.node
group by G.group_id, T.parent_nod, T.parent_lvl
having not exists (select G2.node
from [Group] G2
where G2.group_id = G.group_id
i*i
发帖数: 25
48
来自主题: Database版 - 问一道SQL的题 (转载)
select employee_id,max(sys_connect_by_path(employee_code,',')) result from
(
select employee_id,employee_code,(row_number() over(order by employee
_id,employee_code desc) + rank() over(order by employee_id)) rn
from table2
)
connect by rn-1 = prior rn
group by employee_id;
oracle 9i或以上可实现,结果是对table2聚合
出现
employee_id employ_code
1 a,b,c
接下来就是再写个outer join了就不说了
z********y
发帖数: 14
49
来自主题: Database版 - 请教一个有关SQL concat的问题
try this one
Create function [dbo].[myFun]
(@P1 int)
returns varchar(1000)
as
begin
declare @aa varchar(1000);
set @aa ='';
select @aa = [value] + ',' + @aa from myTable
where id = @P1 order by [value] desc;
return @aa;
end
select top 1 [id] , [dbo].[myFun]([id]) from myTable where [id] = 1;
c*****d
发帖数: 6045
50
在mysql里有一个系统表user
里面有哪个用户允许从哪里登录
desc user;
Field
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)