I have a string stored in a SQL databse that contains a wildcard unicode character followed by whitepsapce before the text I suspect in an attempt to try and mock right to left text and I need to remove the wildcard character however attemptng to search for the characters with a like clause does not locate it…
Tag: sql
Using SQL to group consecutive items that share a common status (dummy data included)
Given a table that has sometimes repeated statuses within a group (in this case “vehicles”), I want to consolidate those statuses into a single row and aggregate status_seconds. The data looks like this (I’ll include some TSQL below to select dummy data into a temp table to make it easy to w…
Can I use DECLARE as an SQL statement in PHP
I am trying to execute a query in PHP, but this code wouldn’t work for some reason, it doesn’t detect the keywords at all(DECLARE, SELECT, WHERE). Is there anything I can do and after all can I even use DECLARE in PHP as a mySQLi statement. $sql2 =”DECLARE @MaxID INT; SELECT @MaxID = MAX(pro…
SQL Statement summarize missing employee certifications
I am trying to create a report on tables that I can’t modify and am not sure if this is even possible. Using the script below, I am trying to get a query result of: Answer You can cross join employees and certifications to generate all possible combinations, then use a subquery to check whether each tup…
d6 delta query – get the latest entry
I’m working on a query but I’m running into an issue with deltas and getting the latest info. If I have a table as such…. I’d like to get results like: I want the latest delta that has a value per ID. I’m writing this in postgres but running into some issues. Any suggestions? Ans…
Update table A by Joining Table B and Table A
I have table A, Table B My database looks some thing like this Table A key1 key2 key5 key6 Table B key3 key4 Data in A.key2 is same as data in B.key3 and A.key5 has same data as B.key 4 I want to …
Hide a row based on a condition in WHERE
My title might be confusing, so I’ll try to explain the best I can. I have two tables LEFT: table numbers RIGHT: table contracts: I want to show, for each instance where there’s a number associated …
Is there the ability for SQL to take a value, use logic, and result a different value
This may be a silly question, but I’m trying to essentially take a value that’s in a field and IF contains “Tele” THEN result Televideo. Or it might be better: IF other than “Office&…
how to get the count of data based on status id in sql
i have following table id statusid 100 1 100 2 100 3 101 1 101 3 i am getting the result like following id data1 data2 data3 100 1 1 1 101 …
How to do not null check on LEFT function on the select query
I have a query that returns some demographics like firstName, lastName, MiddleName and i need to use LEFT function on each to filter the First Letter of each column like LEFt(firstName, 1).This is …