postgresql – Syntax error in query

I am using postgresql and I am getting a syntax error in one of my calculation related queries.
I also checked into the online website I validated it, but it still shows the same. Can anyone help me to solve this problem?

(to_char(round(s_ib_handling_time)/nullif(s_handled),0), 2),'FM99,999,999'))::character varying as aht

Check if the array contains the selected value in a mySQL query with PHP

Might you help me
I need to check if the array contains a specific value in a mySQL query.

In a function I get the value of the day of the week:

$wekc = 4

In the tb_turg table, I have the weekg column that stores the values ​​like this:

idturg weekg
1      1,3,5
2      1,2,4
3      0,4
4      3,6
5      4,6
6      1,2
7      1,4,6
8      0,1,2,3,
9      2,4
10     3,5

Then I created the array like so:

$sqlturg = "SELECT weekg,abng,classg FROM tb_turg WHERE abng != '$nwdatefer' AND classg = '1' ORDER BY idturg ASC";
$querya = $conn->query($sqlturg);
while($rowtg = $querya->fetch_assoc()) {
$weekg = $rowtg("weekg");

@$nwekga .= $weekg." - ";
}

Then I separated this matrix:

$nwekg = rtrim($nwekga, ' - ');
$aw = explode(' - ', $nwekg);
foreach($aw as $bw) {
$cw = $bw;

$sqlga = mysqli_query($conn, "SELECT idturg,weekg FROM tb_turg WHERE weekg = '$cw' AND classg = '1' ORDER BY idmodg ASC");
$rowtga = $sqlga->fetch_assoc();
$idturg = $rowtga("idturg");
$ag = $rowtga("weekg");

$fw = explode(',', $ag);
foreach($fw as $gw) {
$hw = $gw;
}

if (in_array($wekc, $fw)) { 

$sqlgb = mysqli_query($conn, "SELECT idturg,codturg FROM tb_turg WHERE idturg = '$idturg' AND classg = '1'");
$rowtgb = $sqlgb->fetch_assoc();
$idturg = $rowtgb("idturg");
$codturg = $rowtgb("codturg");

echo $idturg . "
"; } else { echo ""; } }

But it doesn't work as it repeats the results of the $ sqlgb query
CONCLUSION: You would have to list the idturg only on the lines that have the 4th (Thursday), without repeating.

Thank you!

azure sql database – How to solve parameter detection problem in query with operator & # 39; in & # 39;

I have a parameter detection problem in this Azure SQL Server consult with in operator:

    Select Col1, Col2, ..., Coln from T1 Join T2 
    On T1.Id = T2.T1Id
    Where T2.Col2 in ('uniqueIdentifier_1','uniqueIdentifier_2',..., 'uniqueIdentifier_m')

I have around 30-40 unique identifiers in the where clause. And I can't replace them because they are primary keys of another table in another Azure SQL Database. As you can see there are a variety of different unique identifiers and it is difficult to adjust.
Could you guide me to solve a parameter sniffing problem?

sharepoint server – query to filter the RelatedItemID column using CAML

I have to filter the RelatedITemID column from the workflow task list using the caml query to get only those records that match the parent ID of its corresponding parent list. How do I achieve this. I tried the query below and it's surprising to know that it doesn't work, instead the query returns all the records regardless of the filter that is applied below.

enter the image description here

In Google spreadsheets, how to make a relative column reference within a query?

I am working with a large data set surrounding around 200 countries right now for a school project. As such, I am using a query formula to transfer raw data to a calculated form for graphing later. Right now I am using this query formula: (where Raw_data is a named range in a different tab)

= query (Raw_data, "SELECT (A / (" & A2 & "/ 10000000)) where (A> 0)")

This works well on its own. However, when dragging to successive columns, I have to manually change A to B etc. twice. If anyone knows how to use a relative column reference, it would be greatly appreciated. What I mean by that is if I drag the above query to the right I would like it to display something like:

= query (Raw_data, "SELECT (B / (" & B2 & "/ 10000000)) where (B> 0)")

Thanks in advance!

google sheets – How to add multiple conditions in a query

so this is completely experimental and not for a class. If anything, I'm doing this because I really don't have class right now. I am self taught and very inexperienced when it comes to something related to the code, but I am an ambitious person. I'm not sure what exactly is relevant, so this may be a bit of a dump with a lot of foreign information.

So I am trying to create a "match" form in Google forms. I have the data that is transferred to Google Sheets, but to unite people, I want people with similar answers to be matched.

I have four different questions with multiple possible answers each. I will refer to the questions in the column where they end on page & # 39; Answer form 1 & # 39; of the sheet.

Column D has 3 options
Column E has 4 options
Column F has 4 options
Column G has 2 options

I just need help doing the query on the first page and then I think I can solve the rest.

So for the first page, I just wanted the answers that answered "Yes" for Column D, "Red" for Column E, "Dog" for Column F, and "Seven" for Column G. They had to have answered exactly answers

I've been playing around with this format, but for some reason it will only allow me to use "and" once:

=query('Form Responses 1’!A:I,”Select * Where D=’Yes’ and E='Red' and F='Dog' and G='Seven'”)

Any help is great. Suppose I don't know anything about any command because I don't know and I would like to learn and understand it.

database: PHP query in a view will cause an error on the website

I am using a global PHP query in a View to find out the membership user count.
The first query, which extracts the total number of users from the database, works fine, but when I use the WHERE In a query for a comparison with a string, I received an error from the website as in the attached image below.

This is the query:

fetchField();
print $count_users_premium;
?>

So if i want to use WHERE some_number = 3, it will work, but the comparison with a string did not work. (Drupal version 8)

enter the image description here

Magento2: How to delete products with attribute through mysql query

I want to remove products from the catalog with the attribute name: website1

through this query I removed all products:

delete from catalog_product_entity;

How to remove only products assigned with attribute: product_from_website: website1

Does anyone have a proven solution?

query performance: querying 500 million records in Oracle view takes forever

I really need professional help now after wasting a week of time to solve my problem and search Stack Overflow. I have a view created on top of two different tables. This view has 500 million records.

watch:-

CREATE VIEW VZ.SERVICE_UTILIZATION
AS (
select T0base.SNO as SNO,
    T0base.SERVICE_CALL_DATE as SERVICE_CALL_DATE,
    T1.LOOKUP_VALUE as ORIG_SYS,
    T2.LOOKUP_VALUE as DEST_SYS,
    T0base.MSG_ID as MSG_ID,
    T7.LOOKUP_VALUE as SERVICE_NAMESPACE,
    T4.LOOKUP_VALUE as OPERATION_ACCESSED,
    T0base.RESPONSE_TIME as SERVICE_PROVIDER_TIME,
    T5.LOOKUP_VALUE as SERVICE_END_POINT,
    T0base.SLA_TIME as SLA_TIME,
    T0base.SUCCESS as SUCCESS,
    T8.LOOKUP_VALUE as PERSPECTIVE,
    T0base.CREATION_DTM as CREATION_DTM,
    T3.LOOKUP_VALUE as SERVICE_TYPE,
    T0base.PROCESS_ID as PROCESS_ID,
    T0base.ACTOR as ACTOR,
    T6.LOOKUP_VALUE as CLIENT_END_POINT,
    T0base.SERVICE_PROVIDER_TIME_TYPE as SERVICE_PROVIDER_TIME_TYPE,
    T0base.PARENT_PROCESS_ID as PARENT_PROCESS_ID,
    T0base.ORIG_SYS_NO as ORIG_SYS_NO,
    T0base.DEST_SYS_NO as DEST_SYS_NO,
    T0base.SERVICE_TYPE_NO as SERVICE_TYPE_NO,
    T0base.OPERATION_NO as OPERATION_ACCESSED_NO,
    T0base.SERVICE_END_POINT_NO as SERVICE_END_POINT_NO,
    T0base.CLIENT_END_POINT_NO as CLIENT_END_POINT_NO,
    T0base.NAMESPACE_NO as NAMESPACE_NO,
    T0base.SERVICEBUSPROCESSID as SERVICEBUSPROCESSID,
    T0base.TRANSACTIONID as TRANSACTIONID,
    T0base.PARTNERMACHINE as PARTNERMACHINE,
    T0base.PARTNERCONNECTIVITYTIME as PARTNERCONNECTIVITYTIME,
    T0base.DATASIZE as DATASIZE
from t_vz_service_utilization T0base
  left join t_vz_lookup T1
    on (T0base.ORIG_SYS_NO = T1.SNO )
  left join t_vz_lookup T2
    on (T0base.DEST_SYS_NO = T2.SNO )
  left join t_vz_lookup T3
    on (T0base.SERVICE_TYPE_NO = T3.SNO )
  left join t_vz_lookup T4
    on (T0base.OPERATION_NO = T4.SNO )
  left join t_vz_lookup T5
    on (T0base.SERVICE_END_POINT_NO = T5.SNO )
  left join t_vz_lookup T6
    on (T0base.CLIENT_END_POINT_NO = T6.SNO )
  left join t_vz_lookup T7
    on (T0base.NAMESPACE_NO = T7.SNO )
  left join t_vz_lookup T8
    on (T0base.PERSPECTIVE_NO = T8.SNO )
)

Now, I'm looking at the different values ​​of this view

SELECT /*+ FULL(su1) PARALLEL(a, 8) */ 
               DISTINCT su1.orig_sys AS orig_sys, 
                        su1.dest_sys AS dest_sys, 
                        su1.operation_accessed AS operation, 
                        su1.service_namespace AS namespace 
          FROM service_utilization su1;

This query operation takes forever to execute. Also, I'm assuming the indexes on the underlying tables don't work when querying the views. I am looking for another alternative to speed up the performance of my query when dealing with views that have over 500 million records.

Note: – Materialized view is not an option for me.

wp query: displays a specific category of products on the store page

I want to display a specific category of products on the top page of the store page.
By default, all products are displayed.
Appearance> Personalize> woocommerce
You can edit from here, but you couldn't do what you wanted.
What you want to do is:
1, show only related products from specific category on top page of store page
2, From the category and tag link of each product page, it is displayed on the store page correctly. Products other than the product related to the specific category selected in "1" are also displayed.
3, search in search console find all products. At this time, products other than the specific category related product selected in "1" are also reflected in the search results.

To meet the above three conditions, I tested the code with reference to another question.
In the attached code, "1" and "2" were deleted, but "3" could not be deleted.
In other words, products that are not related to a specific category will not be found in the search.
How can I make changes to search for products other than products related to the category?

add_action('pre_get_posts','shop_filter_cat');

function shop_filter_cat($query) {
if (!is_admin() && is_post_type_archive( 'product' ) && $query->is_main_query()) {
$query->set('tax_query', array(
array ('taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( '#','#'), //
)
)
); 
}
}