473,836 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

first time code help - PostgreSQL help

1 New Member

I have written code in T-Sql used code converter for PostgreSQL, got below code but it is giving complier error. I have no clue in PostgreSQL so any pointer will be of great help.
Expand|Select|Wrap|Line Numbers
  1. select t.team_id, t.team_name,COALESCE(SUM(num_points),0) num_points from 
  2.    (select team_id, host_team, 3 into team_name, num_points   -----syntax error at or near ","
  3.                                                                                      -----LINE 3:    (select team_id, host_team, 3 into team_name, num_points
  5.    from matches m
  6.    inner join teams t on m.host_team = t.team_id
  7.    where host_goals > guest_goals
  8.    Union All
  9.     select team_id, guest_team,  3 into team_name, num_points
  10.    from matches m
  11.    inner join teams t on m.guest_team = t.team_id
  12.    where guest_goals > host_goals
  13.    Union All 
  14.     select team_id, guest_team,  1 into team_name, num_points
  15.    from matches m
  16.    inner join teams t on m.guest_team = t.team_id
  17.    where guest_goals = host_goals
  18.     Union All 
  19.     select team_id, host_team,  1 into team_name, num_points
  20.    from matches m
  21.    inner join teams t on m.host_team = t.team_id
  22.    where guest_goals = host_goals)
  23.    r
  24.    right outer join teams t on r.team_id = t.team_id
  25.    group by  t.team_id, t.team_name
  26.    order by 1
Aug 30 '21 #1
1 4904
9,065 Recognized Expert Moderator Expert
That is a long and complicated statement, I would break it down and test smaller parts of it.

Alternatively rather than translation from T-SQL I would determine what I wanted to do and re-write it directly in postgresql
Aug 31 '21 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Steve Bishop | last post by:
I have an application that uses data access that runs slow the first time. My first page reads data from an ODBC source and the second page hits a MSDE database. After each page opens the first time, they run just fine. What should I do? I have all my code in ASPX pages right now, but I would like to break it up in some code behind. Also, is this the advantage in pre-compiling data access classes (like in a dll or is there an easier...
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
by: Jason | last post by:
Hi I have a "problem" i have got a ASP.NET application. in this application i have included logging. in the logging i have logged how many seconds it takes for this application to fully load. i have placed these timing loggings in the Load and Init events on a typical aspx page. i.e. first line of code in Page_Load is DateTime dtStart = DateTime.Now; and the last lines of code are
by: TB | last post by:
Hi all: If you think that the following comments are absolute amateurish, then please bear with me, or simply skip this thread. A couple of months back I made the decision to initiate a gradual upgrade of my web programming skills from Classic ASP / VBS to ASP.NET / VB.NET. While the study of the language differences and all the new features in .NET has so far not been a traumatic experience, I am a bit shell-schocked after
by: goldie11 | last post by:
Hi, This is the first time I use a gridview. I have two big problems: 1) I need to assign the columns of the gridview from the code (the cs file )- because the assignment of the columns depends on the user. Different users see different columns. 2) There is a dataTable column that I need to convert in the code
by: chandru116 | last post by:
there is NO current page option in common dialog box...will this be solved in this DLL...can anyone send me code tht uses vbprndlg.dll with this facility.. thnks in advance..
by: kcdoell | last post by:
Hello: I am trying to create a DAO record set for the first time. I wanted to keep it simple, so I first wrote something to work for my Division field then I would expand on the code later. Below is what I have in my onClick event: 'Checks to see if there are records for that given Division, Year, Month, Week Combo. 'If so tells the user to update rstSQL = "SELECT tblStaticAllForecast.DivisionIDFK, " & _ "FROM...
by: dougancil | last post by:
I'm creating a datatable for the first time and I'm having some difficulties. I have the following code: Protected Function Dataparse(ByVal Save As String) As String Dim DataSet ds = new DataSet(); Dim Datatable dt = new Datatable(); System.Data.Odbc.OdbcConnection conn; System.Data.Odbc.OdbcDataAdapter da; string connString; string importFolder =...
by: WesleyN | last post by:
I've a webapplication with UserControls. When I click on a menu-item or a select-button in a grid, than I see that didn't react the first time. When I clicked for the second time then an event behind the button will fire. What do I wrong? I've given the components a unique ID and the events are in the cs-files. <asp:Menu ID="TabMenu" Width="100%" Height="25px" runat="server" Orientation="Horizontal"...
by: vivek484957 | last post by:
Hi Sir, I need your help, here is my query, it is slow first time SELECT COUNT(1) AS Results FROM ImportShipmentNew2013 WHERE CONTAINS(ProductDescription, 'neem') --AND (@HSCode='' OR HSCode = @HSCode ) GROUP BY ForeignCountry (69 row(s) affected) Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.