Skip to content

how to replace ids with names in sql from another table?

I have a table passenger_count pas1_id pas2_id count 1 6 2 14 37 4 that connects by pas_id with another table passenger: id name 1 Bruce k 2 George L 3 Li Wo 4 Don Wa How to replace pas1_id, pas2_id with actual names from passenger table? This self join query does not work: Answer Just join passenger to passe…

Out of Range Error while inserting into a MySQL decimal column

I have this tabular structure: I get an error when i try to insert a specific set of value, query with those values is as below: For longitude with value -161.9722021 it is throwing me an error, values less than 100 value were successfully inserted. I don’t see the value being out of range, the value i …

Where clause on custom column

select c.base_id,case when c.type is not null then c.type else g.type end as type, c.function_id from cust c left join category cg on c.cat_id=cg.id where c.type=’privelleged’; — where clause is …

About “group function is not allowed here”

I have a table with job, salary and date columns. I am writing the following query in PL/SQL, but I am getting an error group function is not allowed here How can I solve this problem? Answer Your query makes no sense (to me, at least). What does that average salary represent? Whose average salary? Here&#8217…

presto sql filter part of the string java

I have a string in col1 select col1 from table “blah blah 123 blah iterate 866 loss blah blah” how to filter string between iterate and loss and just show sum of all such filtered numbers ? Answer You can use regexp_extract to extract the number within that string, convert the values to a numeric …