informix

SQL - WHERE AGGREGATE>1

旧城冷巷雨未停 提交于 2019-11-28 10:42:08
问题 Imagine I have a db table of Customers containing {id,username,firstname,lastname} If I want to find how many instances there are of different firstnames I can do: select firstname,count(*) from Customers group by 2 order by 1; username | count(*) =================== bob | 1 jeff | 2 adam | 5 How do I write the same query to only return firstnames that occur more than once? i.e. in the above example only return the rows for jeff and adam. 回答1: You want the having clause, like so: select

SQL - Converting 24-hour (“military”) time (2145) to “AM/PM time” (9:45 pm)

本秂侑毒 提交于 2019-11-28 08:33:00
问题 I have 2 fields I'm working with that are stored as smallint military structured times. Edit I'm running on IBM Informix Dynamic Server Version 10.00.FC9 beg_tm and end_tm Sample values beg_tm 545 end_tm 815 beg_tm 1245 end_tm 1330 Sample output beg_tm 5:45 am end_tm 8:15 am beg_tm 12:45 pm end_tm 1:30 pm I had this working in Perl, but I'm looking for a way to do it with SQL and case statements. Is this even possible? EDIT Essentially, this formatting has to be used in an ACE report. I

Row numbers for a query in informix

家住魔仙堡 提交于 2019-11-28 04:22:01
问题 I am using informix database, I want a query which you could also generate a row number along with the query Like select row_number(),firstName,lastName from students; row_number() firstName lastName 1 john mathew 2 ricky pointing 3 sachin tendulkar Here firstName, lastName are from Database, where as row number is generated in a query. 回答1: The best way is to use a (newly initialized) sequence. begin work; create sequence myseq; select myseq.nextval,s.firstName,s.lastName from students s;

group_concat in Informix

南楼画角 提交于 2019-11-28 01:41:33
问题 Looking for a query in Informix's SQL that will simulate MySQL's group_concat function. What MySQL's group_concat does is it creates an enumeration of all members in the group. So with the data as follows: orderid:itemName:price 1:Paper :10 1:Pen :5 2:Sugar :15 and the following query: select group_concat(itemName), sum(price) from order_details group by orderid would produce: items :price Paper,Pen:15 Sugar :15 What would be most efficient way to achieve this in Informix? Would we definitely

How can I use ActiveRecord on a database that has a column named 'valid'? (DangerousAttributeError)

做~自己de王妃 提交于 2019-11-27 22:55:00
I am accessing a database that I can't change and it has a column named valid defined. Anytime I try to access an attribute, I get this exception: valid? is defined by ActiveRecord (ActiveRecord::DangerousAttributeError) The exception makes sense, but since I'm not able to change the database, how can I get around this error? I tried "overriding" the attribute, but I don't know how to remove the original column. I can successfully call this valid_column method, but any time I try to access another attribute defined in the database, I get the same exception. It still seems to be trying to map

Oracle默认的用户名和密码是什么?

寵の児 提交于 2019-11-27 13:03:29
Oracle默认的用户名和密码是什么? 在控制台用sqlplus / as sysdba登陆oracle系统时,所用的用户名和密码是什么? 我来答 分享 举报 浏览 135457 次 8个回答 #这个问题不简单# 家长午夜发微信被老师拉黑,家长老师该怎样相处? 最佳答案 Y殷蓝 来自百度知道认证团队 2018-09-10 默认用户名和密码有: 用户名: internal 密码:oracle 用户名:system 密码:manager 用户名:sys 密码:change_on_install 其中直接管理模式可以为sysdba的为后面三个,要是集群的话再去掉system。 扩展资料 : oracle sys密码的重置方法: 在系统运行中输入:sqlplus /nolog 在命令窗口分别执行:conn /as sysdba alter user scott identified by tiger;alter user scott account unlock; 这样就把“scott”用户密码修改为“tiger”了,用户可根据自己需求,重置密码。 抢首赞 评论 分享 举报 收起 ma01fei03 来自百度知道认证团队 2018-09-05 分析如下: (1)用户名:scott 密码:tiger (2)用户名:sys 密码:change_on_install (3)用户名:system

Converting a String to HEX in SQL

若如初见. 提交于 2019-11-27 09:15:58
I'm looking for a way to transform a genuine string into it's hexadecimal value in SQL. I'm looking something that is Informix-friendly but I would obviously prefer something database-neutral Here is the select I am using now: SELECT SomeStringColumn from SomeTable Here is the select I would like to use: SELECT hex( SomeStringColumn ) from SomeTable Unfortunately nothing is that simple... Informix gives me that message: Character to numeric conversion error Any idea? stephenbayer Can you use Cast and the fn_varbintohexstr? SELECT master.dbo.fn_varbintohexstr(CAST(SomeStringColumn AS varbinary)

How can I use ActiveRecord on a database that has a column named 'valid'? (DangerousAttributeError)

风格不统一 提交于 2019-11-27 04:38:04
问题 I am accessing a database that I can't change and it has a column named valid defined. Anytime I try to access an attribute, I get this exception: valid? is defined by ActiveRecord (ActiveRecord::DangerousAttributeError) The exception makes sense, but since I'm not able to change the database, how can I get around this error? I tried "overriding" the attribute, but I don't know how to remove the original column. I can successfully call this valid_column method, but any time I try to access

Which join syntax is better?

我的未来我决定 提交于 2019-11-27 02:22:19
So we are migrating from Informix to Sql Server. And I have noticed that in Informix the queries are written in this manner: select [col1],[col2],[col3],[col4],[col5] from tableA, tableB where tableA.[col1] = table.[gustavs_custom_chrome_id] Whereas all the queries I write in SQL Server are written as: select [col1],[col2],[col3],[col4],[col5] from tableA inner join tableB on tableA.[col1] = table.[gustavs_custom_chrome_id] Now, my first thought was: that first query is bad. It probably creates this huge record set then whittles to the actual record set using the Where clause. Therefore, it's

Consistent method of inserting TEXT column to Informix database using JDBC and ODBC

拜拜、爱过 提交于 2019-11-26 23:30:54
问题 I have problem when I try insert some data to Informix TEXT column via JDBC. In ODBC I can simply run SQL like this: INSERT INTO test_table (text_column) VALUES ('insert') but this do not work in JDBC and I got error: 617: A blob data type must be supplied within this context. I searched for such problem and found messages from 2003: http://groups.google.com/group/comp.databases.informix/browse_thread/thread/4dab38472e521269?ie=UTF-8&oe=utf-8&q=Informix+jdbc+%22A+blob+data+type+must+be