SQL

OrientDB Traverse SQL query efficiency

Apologies I am new to Graphing DB! I have the following basic structure in an OrientDB: I need to obtain all the permission associated with a given User. permission are always contained in a Role but a Role can belong either directly to a User or to a Team. I haven’t added it to the image but the edges between…
Read more

Query to show all rows from sub-query

Need your guide here… I have a query: SELECT * FROM T1 WHERE EXISTS (SELECT * FROM T2 WHERE t1.A = t2.A) AND T1.B = ‘123’; I have tried the below query, but it returns lots of duplicates: SELECT * FROM SAMP_TASK T1 LEFT OUTER JOIN QUOTE_TASK T2 ON T1.A=T2.A AND T1.B = ‘XXX’; The scenario is to show some…
Read more

Remove duplicate row from SQL results

This is my SQL query to get result from ORACLE DB SELECT U.”UID”, CONCAT(CONCAT(U.LNAME, ‘, ‘), U.FNAME) AS UNAME, M.NAME, (SELECT COUNT(LH.”UID”) FROM DRUPAL_SYS.LOGIN_HISTORY LH WHERE LH.”UID”=U.”UID” ) AS VIEWS_COUNT, L.LOGIN as “ACCESS” FROM DRUPAL_SYS.USERS U INNER JOIN DRUPAL_SYS.LOGIN_HISTORY L ON L.”UID” = U.”UID” INNER JOIN ABC_WEBAPP.MEMBER_USER_ROLE MUR ON MUR.USER_ID=U.MDES_ID AND MUR.MEMBER_ID LIKE ‘%’ INNER JOIN ABC_WEBAPP.MEMBER M ON M.ID=MUR.MEMBER_ID…
Read more

How i create a table from a list of values?

i have a really hard work and i don’t know how to implement it in T-SQL (SQL Server). I have a table (TEMP_TABLE) like this: ————————————————————- Measure Column_Name Column_Type TableToBeCreated ————————————————————- ME_AA D_Product [decimal](19,6) STAGIN_MEAA ME_AA D_Store [decimal](19,6) STAGIN_MEAA ME_AA1 D_Product [decimal](19,6) STAGIN_MEAA ME_AA1 D_Store [decimal](19,6) STAGIN_MEAA ME_BB D_Product [decimal](19,6) STAGIN_MEBB ME_BB D_Store [decimal](19,6) STAGIN_MEBB ME_BB D_Time [decimal](19,6) STAGIN_MEBB ME_BB1…
Read more

array_walk & array_combine together is not working for more than 3 fields

I am using the below code to get the Comma separated values from the posted textboxes by using explode(); function and then array_walk() and array_combine(). After that it inserts the data in the table. It is working for two fields but when I put the 3rd it doesn’t work. I’m unable to figure it out. It is not inserting into…
Read more

Update only the top 1 row in sql server

I have a table as below: As You see, the column officebudge updated with value for all individual offices. i want the update happen only top 1 office like below: any suggesion to update the top 1 record? I used below code. but it updates all the office entries: UPDATE budget SET officebudge = ISNULL(ProjectedReturnCount,0) FROM analyticsdata join ( select…
Read more

What is the correct way to concatenate an address in SQL?

In SQL Server 2012, I’m trying to concatenate a few columns regarding the address of a site. However, not all the columns have data – some are blank and some are NULL. The columns and format I need: ADDRESS1, ADDRESS2, ADDRESS3, TOWN, COUNTY, COUNTRY, POSTCODE Obviously, if there’s no address 2 I get the following: ADDRESS1,, ADDRESS3, TOWN, COUNTY, COUNTRY,…
Read more

Can I create UML diagrams from (pasted) SQL statements in Enterprise Architect?

I need to generate some UML diagrams from my SQL snippets. Optimally I’d like a text box to paste my statements and get an UML diagram in return. Is that possible in EA? I looked around but couldn’t find a way – every source I discovered is about the reverse process. Basically, From: CREATE something ( ID INTEGER NOT NULL…
Read more

How to optimize query update ?

I run the following statement and it will update beyond 93 million rows . I need to complete ASAP SET rowcount 10000 update t set [OC]=r.[OC] from [dbo].[Vente] t inner join [dbo].[OC] r on t.[Date Time] between r.[DATE DEBUT] and r.[DATE FIN] while @@rowcount>0 BEGIN update t set [OC]=r.[OC] from [dbo].[Vente] t inner join [dbo].[OC] r on t.[Date Time] between…
Read more

How to bind asp Datalist control from jquery?

I want to display images like gallery, same as this link jquery-lightbox-image-slideshow-gallary but in this link have in asp.net and c# where as I want to apply it by using json bind so how? <asp:DataList ID=”dlImages” runat=”server” RepeatLayout=”Table” RepeatColumns=”3″ CellPadding=”2″ CellSpacing=”20″> <ItemTemplate> <table class=”item” cellpadding=”0″ cellspacing=”0″ border=”0″> <tr> <td align=”center” class=”header”> <asp:Label ID=”Label1″ Text='<%# Eval(“ImageName”) %>’ CssClass=”name” runat=”server” /> </td>…
Read more