mysql – SQL query to return result with different row

I am working with a database that has a table called ‘order’ that looks like the following.

id    day    item  
11     1     apple    
11     3     banana  
11     4     berry  
22     1     coke  
22     3     pepsi  
33     2     chips  
33     4     salsa  

I want mysql query output to look like the following:

id    1       2       3       4
11    apple   null    banana   berry  
22    coke    null    pepsi    null  
33    null    chips   null     salsa  

Is it possible to get such an output using mysql?

How to delete a google sheets row without affecting formula references

My question if you can help is about google sheets getting values from a google forms.
i’m using the query function to get the populated rows once you submit your answer, the problem is that if I delete a row, the the reference used in the formula changes, actually it increment by 1 what gives a black cell, and if i decrease the refertence I get the data. can we delete a row without affecting the references?

here the form link:

here the spreadsheet:

if you use the form, the spreadsheets is populated and the result is in the result sheet, but if i delete all data in FormResponce1, and fill the form again, it works fine with the FormResponces but the result sheet is empty
Thank you,

sql server – Select the first row returned from the join query based on a condition

I have 2 tables PRODUCT and MANUFACTURER



I have to select the default manufacture of a product from the MANUFACTURER table. If no default manufacture is available, i will select a manufacturer by the ITEM_NO from the MANUFACTURER table.

I have written query for this as below:


This query works as expected in SQL Server, but on Oracle it wont work as I am using ‘TOP’ in the query.

Is there any way I can modify the query to work in both SQL Server and Oracle?

wpdb – Check if Value Exists in Database, adding row details to variables and echoing result

I am trying to create a UK Postcode checker for a clients Woocommerce shop. I have created a table in WordPress with the cells, Postcode, Town and County.

When a user enters their postcode into a form and clicks submit, I want to check if the postcode exists in our database, and let the user know.

My code is not recognising whether the postcode exists in the database or outputting the town later.

Any help would be most gratefully appreciated.

global $wpdb;
$table_name = $wpdb->prefix.'vw_postcode_checker';

if (!empty($_POST(postcode)))
    $postcode = $_POST(postcode);
    $entry = $wpdb->get_results("SELECT * FROM ".$tablename."WHERE postcode =" . $postcode);
    if(count($entry) == 1){
         $id = $entry->id;   //We need this for the delete to work.
         $postcode = $entry->postcode;
         $town = $entry->town;
         $county = $entry->county;
         $confirmed = "Contratulations, we are delivering to" . $town;
         echo $confirmed;
    else {
    $notconfirmed = "Sorry, we are not delivering to your area at this time.";
    echo $notconfirmed;

postgresql – How to use COALESCE or CASE when we have more than one row?

So, I have a table like

| id | City     |
| 1  | Seattle  |
| 2  | Portland |

and I want to use coalesce like so:

select coalesce( NULL, ( select id from my_table ))

This query does not make sense but illustrates the idea that one or both arguments of coalesce could return more than one rows, and I want the first non-null value. Both coalesce and CASE WHEN give me the more than one row returned by a subquery used as an expression error. The documentation is surprisingly quiet about this case.

Any other way this can be handled?

Why do tempdb spills still occur even with good row and data size estimates (better than actuals)?

We’re seeing tempdb DB spills for some hashing operations. If the estimates are indeed good as shown what would be the next thing(s) to look for? Looking for a generic answer without having to resort to the specifc query.

This is part of an SP. Just switched to 2019 version to see if it would auto adjust but still getting spills so far.

Microsoft SQL Server 2019 (RTM) – 15.0.2000.5 (X64)

Hash Match Warnings

sharepoint online – Using a value from previous row in a new list entry

Like Siddharth suggested I think your requirement can be easily fulfilled using calculated columns. To do this click on add column and select more then on the new screen select calculated. Rest is pretty basic stuff You can see the attached screenshot for more reference. Once you have done selecting all the settings click on OK.
and Viola you problem is solved :]
enter image description here

The new column would look something like this
enter image description here

Hope this helped somebody out there :]

search – Data row lookup in separate big data sheet and placing it inside another sheet in Google spreadsheet

I would like to make a Google spreadshit for calorie tracking. In my head I imagine it as I would like to have a sheet where I will record daily food activity. And another DB sheet with all time consumed food types with their parameters. So, the idea is when I type food name in daily diary sheet it will lookup in DB sheet if I already recorded this food macros and the food exists it just places reference to the existing food or copies its parameters. So, my question is it possible to implement something like spotlight? When I type some characters it displays kind of popup with suggestions based on DB sheet data and if I choose popup element it gives me a reference to that data. Ideally it would be great to have a fuzzy search. Maybe someone knows in which directions may I start to research or some impelemnted solutions?

automation – How to automatically add data series to line chart when new row of data added to underlying sheet?

I have a line chart where the X-axis is Day of Week and Y-axis is a count. The underlying sheet has Sunday dates in column A, where each row is one week apart, and columns B-H have count values for Sunday through Saturday, one week per row.

The sheet auto-updates as new data comes in, but not the chart.

In Chart Editor > Setup > Data range I specified A1:H1000, and when I click the Add Series button at the bottom the chart editor readily offers up the new rows (i.e. I don’t have to specify the cell ranges, they are already detected) but I do have to explicitly click each one to add them to the chart.

Is there a way to bypass this final manual step, so the chart draws a new data series line whenever a new row of data is added to the underlying sheet?