I have a database with two tables one table (shops) has an admin user column and the other a user with less privileges. I plan to LEFT JOIN the table of the user with less privileges. When I retrieve the data, the records for the admin user must be on a separate row and must have NULL values for the
Tag: sql
SQL CASE with multiple join
I am trying to run a sql select code as below. I am trying to fetch the trans_date which will either be in asutrans or asuhistr. But the below code doesnt give me any value and nor does it fail. Do you think we can use CASE statement like that? If I run the codes separately, then it does give
how to add select statement in IN clause in pivot
iam using pivot table in SQL query.. i need to make some columns as rowss, but i need to use select statement in IN clause where we givt option like this normally we give option like but with select statement its giving me error?? what can be done. Answer use this i got answer from some of google posts
SQL Server Convert Varchar to Datetime and Find Max Value
I try to find max date from a DATE column, the column format is YYYY-MM and its of type varchar. I tried with the following SQL code: Answer You can try the below way –
Use select inside ‘filename’ property of utl_file.fopen
I have a procedure that extracts data from a view and stores it on disc in CSV format. I’d like a name of the file to contain the most recent timestamp from table MY_TIMESTAMPS. For now it looks like this: The part with (select to_char(max(EVENT_TS)) from MY_TIMESTAMPS) throws an error. How can I set th…
R: How to use “NOT IN” logic in R
How can I convert below sql query to R Logic: SELECT * FROM FRUITS WHERE (ID||TYPE||DATE) NOT IN (SELECT (ID||TYPE||DATE) FROM SEASONAL_FRUITS)
Insufficient user permission performing an operation on Sql Server Azure
I am trying to re-run migration on a newly created DB in azure. DB, User, and all privileges were created from scratch. I basically granted all operation permission to the user including DB admin …
Efficient way to simultaneously calc AVG and stddev_pop in postgres
stddev_pop() must be calculating AVG() as part of the full calc of standard deviation (unless there’s a shortcut I’m unaware of). for context, the goal is to test for the difference of means between …
Count the number of times word appears in a single column
I’m attempting to count the number of times apples and oranges appear in my fruit column. The table looks like this: Expected output: My code thus far. I’m not sure how to do it when both appear and how to add them to the totals. I’m sure there is an easier way that this. Cheers Answer If th…
How do I extract a value from an XML column in SQL Server
I have a column SCORERESULTS in table CSE_ARCHIVEDCREDITSCORE. Score results is an XML column. <Profile id="Navigation" version="1" num="4" …