Questions tagged [ifnull]

This tag refers to the process of determining whether or not a particular object is null, and then running certain code based off of that condition.

Use this tag for questions related to running certain code depending on whether or not one or more objects is null.

161 questions
0
votes
1 answer

How to use IFNULL with yii CDbCriteria?

In yii, i have a CDbCriteria with select property as: $criteria->select = "IFNULL(t.cccid,'Default')"; That is I want to return 'Default' if t.cccid is NULL. Else value of t.cccid should be returned/ The problem is that IFNULL is not being…
Mahesh
  • 603
  • 1
  • 10
  • 22
0
votes
1 answer

Android - Sort calls by cached name if exist (use of ifnull in sqlite)

i would like sort the call logs by cached name. The cached name can be null. So in the case of a null cached name, i would like to have the phone number for an alias. in sqlite, there is the ifnull() function. ifnull details I try : String[]…
user785975
  • 169
  • 1
  • 3
  • 11
0
votes
2 answers

MySQL IFNULL, Alias and LEFT JOIN result an Unknown column error

This is my simplified query: SELECT `student`.`id`, `student`.`firstname`, `student`.`lastname`, IFNULL(`review`.`score`, '0') AS `adminreview_score`, `reviewcolor`.`color` AS adminreview_color FROM (`student`) LEFT JOIN `review` ON…
Mohammad Naji
  • 5,372
  • 10
  • 54
  • 79
0
votes
2 answers

MySQL IF NOT EXISTS / IFNULL SELECT other column

I want to check, if a column (mysql) exists. If not, mysql should take the value from a column that definitely exists. My Query looks like this, but it does not work: IF NOT EXISTS (SELECT `en` FROM `HP_strings` WHERE…
user1435792
  • 3
  • 1
  • 3
-1
votes
1 answer

UPDATE NULL of a column matching the ID in the same table

I'm working on housing data with several columns. In the cleaning process, I noticed that in the column 'PropertyAddress' are a few Null, and I want to confirm if those Null could be matched with the ParcelID. So, I wrote the following query to…
Alex
  • 3
  • 2
-1
votes
1 answer

How to count and join between two MySQL tables?

I want to write out the number of times a car has been rented and I just cant get it to work, I have two tables. one is called vehicle and the other rental. In rental is where all the "rentings" go when you book a car and all the vehicles is stored…
fredan
  • 13
  • 2
-1
votes
1 answer

check if_null statement don't work

I simply want to check, if a query give me 'NULL' as the result. $check = ' SELECT some_data FROM user WHERE condition = my_condition LIMIT 1'; if ( is_null($check) ) { echo "yep, it's null"; …
-1
votes
1 answer

MySQL IFNULL() with multiple tables still isn't working

I know I already asked this question here but haven't had a good answer so I try it again and this time I hope I can give enough information for you guys. Before I ask my question I'll show you how I created (the usefull part of) my database: CREATE…
MichaelDeBoey
  • 2,335
  • 1
  • 19
  • 19
-1
votes
3 answers

mysql how to find if at least one row from cross reference table is null or criteria

i have trouble with mysql, i dont find the way to do it maybe i dont know the good mysql keyword mysql5 +----------+------------+----------+ | ID | FOREIGNKEY | TRAINER | +----------+------------+----------+ | ... | ... | ... …
juhnz
  • 304
  • 3
  • 11
-2
votes
2 answers

How to create a temporary table using ifnull

I need to create a query that will show the name of the project with the lowest, yet closest id, that is also considered a "key" project, based on whether or not the Task code is empty. This might seem a bit convoluted, so i'll put it in a…
RazorFinger
  • 231
  • 2
  • 12
-3
votes
1 answer

MySQL IFNULL syntax on outer query to return a record when query does not return any records

I'm looking for guidance on how to apply IFNULL to an outer query in my mySQL Query. The query checks for new timecards submitted the previous day and kicks off a procedure that writes the results to a file server. Frequently there are no records…
1 2 3
10
11