null

After aliasing sql field on select, I can not access the result in php

不想你离开。 提交于 2019-12-12 03:47:51
问题 I have a SQL SELECT in which I aliased MIN(A.product_id + 1) to 'min': $product='SELECT * FROM '.$table.' WHERE product_id > '.(($div_id)*10000).' AND product_id < '.((($div_id+1)*10000)-1).''; $select='SELECT MIN(A.product_id + 1) AS min FROM ('.$product.') A LEFT JOIN ('.$product.') B ON A.product_id = B.product_id - 1 WHERE B.product_id Is NULL'; this is the result in phpMyAdmin: But in php I have 'min' => NULL $result = mysql_query($select, $con); $row=mysql_fetch_assoc($result); echo

Calculating percent change from one record to next using a SQL query

瘦欲@ 提交于 2019-12-12 03:47:50
问题 I am using this query to calculate percent change of Enrollment total from current semester to the last. What changes do I need to make to this query to avoid nulls ? I have tried using a sub query which is painfully slow. SELECT E2.Term AS Prev_Term, E2.[Enrollment Total] AS Prev_Enrl_Tot, E1.Term, E1.Location, E1.milestone_description, E1.polling_date, Round(((E1.[Enrollment Total] - [Prev_Enrl_Tot]) / [Prev_Enrl_Tot]) * 100,2) AS Percent_Change FROM EnrollmentsByLocation E1 LEFT OUTER JOIN

Searching through all columns in a table

对着背影说爱祢 提交于 2019-12-12 03:32:55
问题 I have a table with 300+ columns, many of these columns have no data in them. is there a query I can use to find out the names of these columns so I can remove them for the table. Also I am using a postgresql database on a redshift server if that matters 回答1: First you get the field names SELECT * FROM information_schema.columns WHERE table_schema = 'your_schema' AND table_name = 'your_schema' Then using a loop you create a dinamic query SELECT count(*) FROM 'your_schema'.'your_schema' WHERE

Error #1009, ActionScript 3

余生颓废 提交于 2019-12-12 03:08:42
问题 I am using a SWF(accueil) inside another SWF(ranchleblanc_fr) and this causes the error 1009 to appear: TypeError: Error #1009: Cannot access a property or method of a null object reference. at accueil_fla::MainTimeline/frame1()" The first SWF has a particle effect in it and it won't start when I first load the page. If i click on any button of the main page and return to the accueil page, the effect works. But if I click on another button again, I get another error 1009, but this time it

MVC3 Data in model set to null when posting

左心房为你撑大大i 提交于 2019-12-12 02:40:10
问题 I have a view right now where the model is a list of models that get passed into a partial view and displayed as a list on the page. The partial view has a form that, when submitted, should send the Model back to the controller where it can redirect the model to a page for editing its properties. However, one of the data members of the model is set to null after posting and I can't figure out why. Here's the code I'm using that affects this part of the program: The Model public class

How to show null value in p:SelectOneMenu ONLY when said value is null in the backing bean?

浪尽此生 提交于 2019-12-12 02:09:30
问题 Here's my selectOneMenu: <h:form> <p:selectOneMenu id="handlerSelect" value="#{caseController.case.handler}" converter="omnifaces.SelectItemsIndexConverter" style="width:182px"> <f:selectItems value="#{handlerController.findAllHandlers()}" var="handlerSelect" itemLabel="#{handlerSelect.name}" itemValue="#{handlerSelect}" /> <p:ajax event="change"listener="#{caseController.changeHandler}" update="handlerSelect"/> </p:selectOneMenu> </h:form> The default value showing in this selectOneMenu as

Why not have Jave methods return a tuple instead of an object reference (or null)?

孤人 提交于 2019-12-12 02:04:21
问题 Typically Java methods look like: public <U,V> U doSomething(V aReference) { // Do something } This typically means that the method doSomething() returns a null if it fails (for whatever reason) or a valid object reference. In some cases the "valid object reference" may itself be null . For example, the method aMap.get(k) may return null if there is no key k or if there is a key k but its corresponding value is null . Confusion! Not to mention NullPointerException s if 50% of your LOC isn't

Get the frame of UITableViewCellAccessoryDetailButton (which is nil)

丶灬走出姿态 提交于 2019-12-12 01:54:05
问题 I was trying to present a popover from a UITableViewCell 's accessoryView. The view is the default UITableViewCellAccessoryDetailButton . Apparently the accessoryView is nil , and, according to this question, this is an intended behavior. My question is, how do I get the frame of the accessory, even though the accessoryView property is nil? 回答1: You don't need to get the frame to present the popover. When you have an accessory view, the width of the cell's contentView is made narrower so it

UIImage returns nil

我的未来我决定 提交于 2019-12-12 01:33:27
问题 I'll be creating an UIImage but if I debug the method it returns nil . I hope someone know what I have to do. My code: returns nil: UIImage *image1 = imgView.image; Whole block of code: UIImage *image1 = imgView.image; NSString *cachedFolderPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0]; NSString *cachedImagePath = [cachedFolderPath stringByAppendingPathComponent:@"image1.png"]; [UIImagePNGRepresentation(image1) writeToFile:cachedImagePath atomically

Why is MySQL changing null to zero?

家住魔仙堡 提交于 2019-12-12 01:23:24
问题 I'm completely new to databases and SQL. I have a column marked NOT NULL . When I forget to give a value to that column when doing an INSERT, it inserts a 0 value in that column. Is there anything I can do to make it return an error instead of changing the NULL to 0? 回答1: You want to have a look at the SQL_MODE configuration. It allows you to define how strict MySQL handles such things. By default it is pretty lenient which is not what I usually want. It also depends on the data type,