sql

Power BI Report with Bridge Table

≡放荡痞女 提交于 2021-02-17 02:42:30
问题 I am trying to use Power BI with my SQL DB. We have a three layer structure A Main table, with information about the year and unique key for each firm A bridge table which an information about the type of the firm Many end Tables with information about sales and stuff On some occasions these end tables are jointly used by different firm types and some only by one firm type. When I load the tables into Power BI all the relationships are correctly imported and I was expecting no issue to create

MySQL - A query based on another query

為{幸葍}努か 提交于 2021-02-17 02:08:35
问题 I write a lot of queries resembling the query example code below. I was wondering whether there was a more efficient code/script? $query1 ="SELECT * FROM table1 WHERE date >= '$todaysdate' "; $result1 = mysql_query($query1) or die ("Error in query: $query1. " . mysql_error()); if (mysql_num_rows($result1) > 0) { while($row1 = mysql_fetch_object($result1)) { echo "$row1-date"; $query2 ="SELECT * FROM table2 WHERE table1ID >= '$row1-table1ID' "; $result2 = mysql_query($query2) or die ("Error in

How to read from the two same dates without input the time

懵懂的女人 提交于 2021-02-17 02:07:48
问题 I have a query like below. SELECT occupation AS 'Contact occupation', sum(total) AS 'Quantity' FROM ( SELECT CASE WHEN contacts.occupation IS NULL THEN 'Other' WHEN trim(contacts.occupation) = '' THEN 'Other' ELSE contacts.occupation END AS occupation, count(DISTINCT(concat(patients.id, '-', individual_appointments.practitioner_id))) AS total FROM individual_appointments JOIN patients ON patients.id = individual_appointments.patient_id JOIN practitioners ON practitioners.id = individual

MySQL - A query based on another query

∥☆過路亽.° 提交于 2021-02-17 02:06:15
问题 I write a lot of queries resembling the query example code below. I was wondering whether there was a more efficient code/script? $query1 ="SELECT * FROM table1 WHERE date >= '$todaysdate' "; $result1 = mysql_query($query1) or die ("Error in query: $query1. " . mysql_error()); if (mysql_num_rows($result1) > 0) { while($row1 = mysql_fetch_object($result1)) { echo "$row1-date"; $query2 ="SELECT * FROM table2 WHERE table1ID >= '$row1-table1ID' "; $result2 = mysql_query($query2) or die ("Error in

hibernate bug:ArrayIndexOutOfBoundsException on...

孤街浪徒 提交于 2021-02-17 02:01:13
昨天给程序加上了2级缓存,今天打开查询统计页面,就报错: ava.lang.ArrayIndexOutOfBoundsException: 0 at org.hibernate.type.TypeHelper.disassemble(TypeHelper.java:146) at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:106) at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2434) at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2321) 才开始以为是java 版本换了的原因,最后直接搜索错误找到了这样个bug: ArrayIndexOutOfBoundsException on enabling cache for a Native SQL query 高版本的已经修订了这个错误,但换hibernate 版本肯定又一堆问题,所以在使用native sql query 的时候加上: q.setCacheable(false); 这样 就OK 了,2级缓存 语句缓存同意还是开启的,本地sql 查询禁用2级查询缓存就可以了 来源

How to get total weight of a case size e.g. 12 x 160g equal to 1.92kg

若如初见. 提交于 2021-02-16 23:43:13
问题 Not sure if this is possible. But, let's say I have a column like this in a table: 12 x 60g 12 x 160g 500g 1kg 1kg 12 x 160g 12 x 250g Some are are individual sizes and some are case sizes. Is it possible to get the total weight for each row? If so, how would it be done? e.g. 0.72kg /* 12 x 0.060 = 0.72 */ 1.92kg /* 12 x 0.160 = 1.92 ... */ 0.5kg 1kg 1kg 1.92kg 3kg 回答1: Adding to the comment by @Tomalak, below is an example script you could use to populate the weight expression translation

How can I find the right size box for each product?

一曲冷凌霜 提交于 2021-02-16 22:55:52
问题 I am sorry for re-uploading this quesiton, but I really want the answer. Kindly allow me to ask this question again and hope your kind support. The question is to find the right size box which allow the logistic business to save the money when shipping. We have 2 tables which are boxes and products. Boxes table contains each ID and dimensions per box. 'w' for wide, 'd' for depth and 'h' for height. Please assume we have just 3 box samples for our convenience. Products table includes also

Natural or Human Sort order

喜你入骨 提交于 2021-02-16 21:56:56
问题 I have been working on this on for months. I just cannot get the natural (True alpha-numeric) results. I am shocked that I cannot get them as I have been able to in RPG since 1992 with EBCDIC . I am looking for any solution in SQL, VBS or simple excel or access. Here is the data I have: 299-8, 3410L-87, 3410L-88, 420-A20, 420-A21, 420A-40, 4357-3, AN3H10A, K117GM-8, K129-1, K129-15, K271B-200L, K271B-38L, K271D-200EL, KD1051, KD1062, KD1092, KD1108, KD1108, M8000-3, MS24665-1, SK271B-200L,

ORA-38104: Columns referenced in the ON Clause cannot be updated c.emp_id

佐手、 提交于 2021-02-16 21:32:36
问题 i have 2 simple table CREATE TABLE employee ( emp_id INT PRIMARY KEY, first_name VARCHAR(40), last_name VARCHAR(40), birth_day DATE, sex VARCHAR(1), salary INT, super_id INT, branch_id INT ); CREATE TABLE biodata ( emp_id INT PRIMARY KEY, first_name VARCHAR(40), last_name VARCHAR(40), birth_day DATE, sex VARCHAR(1) ); i want to merge it merge into biodata c using employee e on (c.emp_id = e.emp_id) when matched then update set c.emp_id=e.emp_id, c.first_name=e.first_name, c.last_name=e.last

ORA-38104: Columns referenced in the ON Clause cannot be updated c.emp_id

假装没事ソ 提交于 2021-02-16 21:32:08
问题 i have 2 simple table CREATE TABLE employee ( emp_id INT PRIMARY KEY, first_name VARCHAR(40), last_name VARCHAR(40), birth_day DATE, sex VARCHAR(1), salary INT, super_id INT, branch_id INT ); CREATE TABLE biodata ( emp_id INT PRIMARY KEY, first_name VARCHAR(40), last_name VARCHAR(40), birth_day DATE, sex VARCHAR(1) ); i want to merge it merge into biodata c using employee e on (c.emp_id = e.emp_id) when matched then update set c.emp_id=e.emp_id, c.first_name=e.first_name, c.last_name=e.last